diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/flake.lock b/flake.lock index 903dc94..8ac7fdf 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,28 @@ { "nodes": { + "alejandra": { + "inputs": { + "fenix": "fenix", + "flakeCompat": "flakeCompat", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1744324181, + "narHash": "sha256-Oi1n2ncF4/AWeY6X55o2FddIRICokbciqFYK64XorYk=", + "owner": "kamadorueda", + "repo": "alejandra", + "rev": "3e2a85506627062313e131bf8a85315f3387c8e0", + "type": "github" + }, + "original": { + "owner": "kamadorueda", + "ref": "4.0.0", + "repo": "alejandra", + "type": "github" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -68,6 +91,28 @@ "type": "github" } }, + "fenix": { + "inputs": { + "nixpkgs": [ + "alejandra", + "nixpkgs" + ], + "rust-analyzer-src": "rust-analyzer-src" + }, + "locked": { + "lastModified": 1730615655, + "narHash": "sha256-2HBR3zLn57LXKNRtxBb+O+uDqHM4n0pz51rPayMl4cg=", + "owner": "nix-community", + "repo": "fenix", + "rev": "efeb50e2535b17ffd4a135e6e3e5fd60a525180c", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "fenix", + "type": "github" + } + }, "firefox-gnome-theme": { "flake": false, "locked": { @@ -100,6 +145,24 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1778716662, + "narHash": "sha256-m1Yf0wZ8j1OHjTc2UwHwyQRSnNeSgLJOd7q5Y45hzi4=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7c1a2d347e4c52d5fb8d10cb4d94b5884e546fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "stylix", @@ -138,6 +201,22 @@ "type": "github" } }, + "flakeCompat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "fromYaml": { "flake": false, "locked": { @@ -194,7 +273,7 @@ "lib-aggregate": { "inputs": { "flake-utils": "flake-utils", - "nixpkgs-lib": "nixpkgs-lib" + "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { "lastModified": 1779025127, @@ -301,6 +380,21 @@ } }, "nixpkgs-lib": { + "locked": { + "lastModified": 1777168982, + "narHash": "sha256-GOkGPcboWE9BmGCRMLX3worL4EMnsnG8MyKmXNeYuhQ=", + "owner": "nix-community", + "repo": "nixpkgs.lib", + "rev": "f5901329dade4a6ea039af1433fb087bd9c1fe14", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixpkgs.lib", + "type": "github" + } + }, + "nixpkgs-lib_2": { "locked": { "lastModified": 1778984393, "narHash": "sha256-r755Kh5Q0XBTPNuv9rL2rsUJTq8BDhb+lIwRWhl6yYA=", @@ -487,6 +581,8 @@ }, "root": { "inputs": { + "alejandra": "alejandra", + "flake-parts": "flake-parts", "home": "home", "niri": "niri", "nix-monitored": "nix-monitored", @@ -499,6 +595,23 @@ "stylix": "stylix" } }, + "rust-analyzer-src": { + "flake": false, + "locked": { + "lastModified": 1730555913, + "narHash": "sha256-KNHZUlqsEibg3YtfUyOFQSofP8hp1HKoY+laoesBxRM=", + "owner": "rust-lang", + "repo": "rust-analyzer", + "rev": "f17a5bbfd0969ba2e63a74505a80e55ecb174ed9", + "type": "github" + }, + "original": { + "owner": "rust-lang", + "ref": "nightly", + "repo": "rust-analyzer", + "type": "github" + } + }, "rust-overlay": { "inputs": { "nixpkgs": [ @@ -526,7 +639,7 @@ "base16-helix": "base16-helix", "base16-vim": "base16-vim", "firefox-gnome-theme": "firefox-gnome-theme", - "flake-parts": "flake-parts", + "flake-parts": "flake-parts_2", "gnome-shell": "gnome-shell", "nixpkgs": [ "nixpkgs" diff --git a/flake.nix b/flake.nix index 2e6f157..d62b757 100644 --- a/flake.nix +++ b/flake.nix @@ -28,6 +28,13 @@ url = "github:noctalia-dev/noctalia-qs"; inputs.nixpkgs.follows = "nixpkgs"; }; + alejandra = { + url = "github:kamadorueda/alejandra/4.0.0"; + inputs = { + nixpkgs.follows = "nixpkgs"; + }; + }; + flake-parts.url = "github:hercules-ci/flake-parts"; }; nixConfig = { @@ -57,20 +64,33 @@ overlays = [ inputs.rust-overlay.overlays.default inputs.niri.overlays.niri + (_: prev: + {alejandra = + inputs.alejandra.defaultPackage.${prev.stdenv.hostPlatform.system};}) ]; - in { - nixosConfigurations = lib.genNixOSHosts { - inherit inputs config overlays self; - baseModules = [ - home.nixosModules.home-manager - self.nixosModules.default - inputs.niri.nixosModules.niri - inputs.stylix.nixosModules.stylix - inputs.nix-monitored.nixosModules.default - ]; + in inputs.flake-parts.lib.mkFlake {inherit inputs;} { + perSystem = {pkgs, system, ...}: { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ + alejandra + just + nil + ]; + }; }; + flake = { + nixosConfigurations = lib.genNixOSHosts { + inherit inputs config overlays self; + baseModules = [ + home.nixosModules.home-manager + self.nixosModules.default + inputs.niri.nixosModules.niri + inputs.stylix.nixosModules.stylix + inputs.nix-monitored.nixosModules.default + ]; + }; - homeConfigurations = lib.genHomeHosts { + homeConfigurations = lib.genHomeHosts { inherit inputs config overlays; user = "joshua"; @@ -82,28 +102,30 @@ inputs.noctalia.homeModules.default inputs.stylix.homeModules.stylix ]; + }; + + homeModules.default = import ./modules/home; + nixosModules.default = import ./modules/nixos; + #TODO put home-manager in dtcommon + # nixosConfigurations.prospero = nixpkgs.lib.nixosSystem { + # system = "x86_64-linux"; + # modules = [ + # ./all.nix + # home-manager.nixosModules.home-manager + # ./dt-common.nix + # ./prospero/configuration.nix + # ]; + # }; + # nixosConfigurations.uruk = nixpkgs.lib.nixosSystem { + # system = "x86_64-linux"; + # modules = [ + # ./all.nix + # home-manager.nixosModules.home-manager + # ./dt-common.nix + # ./uruk/configuration.nix + # ]; + # }; }; - - homeModules.default = import ./modules/home; - nixosModules.default = import ./modules/nixos; - #TODO put home-manager in dtcommon - # nixosConfigurations.prospero = nixpkgs.lib.nixosSystem { - # system = "x86_64-linux"; - # modules = [ - # ./all.nix - # home-manager.nixosModules.home-manager - # ./dt-common.nix - # ./prospero/configuration.nix - # ]; - # }; - # nixosConfigurations.uruk = nixpkgs.lib.nixosSystem { - # system = "x86_64-linux"; - # modules = [ - # ./all.nix - # home-manager.nixosModules.home-manager - # ./dt-common.nix - # ./uruk/configuration.nix - # ]; - # }; + systems = [ "x86_64-linux" "aarch64-linux" ]; }; } diff --git a/justfile b/justfile new file mode 100644 index 0000000..8ee29b7 --- /dev/null +++ b/justfile @@ -0,0 +1,7 @@ +apply: + nixos-rebuild switch --flake . --sudo + home-manager switch --flake . +apply-boot: + nixos-rebuild boot --flake . --sudo +hm: + home-manager switch --flake .