summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth Flynn <[email protected]>2025-02-02 14:32:28 -0500
committerSeth Flynn <[email protected]>2025-02-02 14:32:28 -0500
commit2a05e0b50272f7ec681e33588bc5fc79f72f44af (patch)
treed97c04a7b821b2f5a8a37a8d12a121e6b248d3ba
parent26b52db5ca8d1483ca75f23b7b1a6fd5b2cf0e4d (diff)
templates/nixos: use configurations flake module
-rw-r--r--templates/nixos/flake.nix67
1 files changed, 38 insertions, 29 deletions
diff --git a/templates/nixos/flake.nix b/templates/nixos/flake.nix
index f78331c..6dce551 100644
--- a/templates/nixos/flake.nix
+++ b/templates/nixos/flake.nix
@@ -8,12 +8,25 @@
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
+
+ flake-parts = {
+ url = "github:hercules-ci/flake-parts";
+ inputs.nixpkgs-lib.follows = "nixpkgs";
+ };
+
+ getchpkgs = {
+ url = "github:getchoo/getchpkgs";
+ inputs.nixpkgs.follows = "nixpkgs";
+ };
};
outputs =
- { self, nixpkgs, ... }@inputs:
- let
- inherit (nixpkgs) lib;
+ inputs:
+
+ inputs.flake-parts.lib.mkFlake { inherit inputs; } {
+ imports = [
+ inputs.getchpkgs.flakeModules.configurations
+ ];
systems = [
"x86_64-linux"
@@ -22,37 +35,33 @@
"aarch64-darwin"
];
- forAllSystems = lib.genAttrs systems;
- nixpkgsFor = nixpkgs.legacyPackages;
- in
- {
- nixosConfigurations.myComputer = nixpkgs.lib.nixosSystem {
- modules = [ ./configuration.nix ]; # You should already have this
- specialArgs = {
- # Gives your configuration.nix access to the inputs from above
- inherit inputs;
+ configurations = {
+ nixos = {
+ my-machine = {
+ # You should already have this file in /etc/nixos
+ modules = [ ./configuration.nix ];
+ };
};
};
- devShells = forAllSystems (
- system:
- let
- pkgs = nixpkgsFor.${system};
- in
+ perSystem =
+ { pkgs, self', ... }:
+
{
- default = pkgs.mkShellNoCC {
- packages = [
- pkgs.fzf
- pkgs.just
-
- # Lets you run `nixfmt` to format all of your files
- self.formatter.${system}
- ];
+ # Use `nix develop` to enter a shell with tools for this repository
+ devShells = {
+ default = pkgs.mkShellNoCC {
+ packages = [
+ pkgs.just
+
+ # Lets you run `nixfmt` to format all of your files
+ self'.formatter
+ ];
+ };
};
- }
- );
- # You can also use `nix fmt`
- formatter = forAllSystems (system: nixpkgsFor.${system}.nixfmt-rfc-style);
+ # You can also use `nix fmt`
+ formatter = pkgs.nixfmt-rfc-style;
+ };
};
}