diff --git a/config-manager/default.nix b/config-manager/default.nix index 46c6b92..ce53dfb 100644 --- a/config-manager/default.nix +++ b/config-manager/default.nix @@ -15,7 +15,7 @@ Usage: Flags: --update updates the flake - --switch rebuilds + switches configuration + --switch rebuilds + switches configuration (using `nh`) EOF } @@ -25,8 +25,7 @@ EOF } switch() { - echo -e "\033[0;31mREBUILDING + SWITCHING CONFIG\033[0m" - sudo nixos-rebuild switch --flake ${flakePath}#${nixosConfiguration} + nh os switch --ask --hostname ${nixosConfiguration} ${flakePath} } case $1 in diff --git a/flake.lock b/flake.lock index 93316c7..f08bed7 100644 --- a/flake.lock +++ b/flake.lock @@ -66,6 +66,24 @@ "type": "github" } }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1693611461, + "narHash": "sha256-aPODl8vAgGQ0ZYFIRisxYG5MOGSkIczvu2Cd8Gb9+1Y=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "7f53fdb7bdc5bb237da7fefef12d099e4fd611ca", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -145,6 +163,43 @@ "type": "github" } }, + "nh": { + "inputs": { + "flake-parts": "flake-parts", + "nix-filter": "nix-filter", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1696149398, + "narHash": "sha256-RwlAyww4bzeu2ndeQoScelYtlYiSxPdCn70R+xGdZBc=", + "owner": "viperML", + "repo": "nh", + "rev": "2985f5a45d6f3e1a9d8d3ca5c777ef1bc9c7fbd1", + "type": "github" + }, + "original": { + "owner": "viperML", + "repo": "nh", + "type": "github" + } + }, + "nix-filter": { + "locked": { + "lastModified": 1694857738, + "narHash": "sha256-bxxNyLHjhu0N8T3REINXQ2ZkJco0ABFPn6PIe2QUfqo=", + "owner": "numtide", + "repo": "nix-filter", + "rev": "41fd48e00c22b4ced525af521ead8792402de0ea", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "nix-filter", + "type": "github" + } + }, "nixos-hardware": { "locked": { "lastModified": 1696161939, @@ -177,6 +232,24 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1693471703, + "narHash": "sha256-0l03ZBL8P1P6z8MaSDS/MvuU8E75rVxe5eE1N6gxeTo=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3e52e76b70d5508f3cec70b882a29199f4d1ee85", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1695825837, @@ -215,6 +288,7 @@ "emacs-overlay": "emacs-overlay", "home-manager": "home-manager_2", "hyprland-contrib": "hyprland-contrib", + "nh": "nh", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", "nixpkgs2211": "nixpkgs2211" diff --git a/flake.nix b/flake.nix index c3b9f56..17bd732 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,11 @@ nixos-hardware.url = "github:nixos/nixos-hardware/master"; + nh = { + url = "github:viperML/nh"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -28,7 +33,7 @@ }; }; - outputs = { self, ... } @inputs : { + outputs = { self, ... }@inputs: { nixosConfigurations = { pinwheel = let system = "x86_64-linux"; diff --git a/hosts/pinwheel/configuration.nix b/hosts/pinwheel/configuration.nix index 9098a98..dbf1957 100644 --- a/hosts/pinwheel/configuration.nix +++ b/hosts/pinwheel/configuration.nix @@ -90,6 +90,7 @@ environment.systemPackages = with pkgs; [ inputs.agenix.packages."${system}".default + inputs.nh.packages."${system}".default coreutils gnumake bash