diff options
| -rw-r--r-- | flake.nix | 5 | ||||
| -rw-r--r-- | templates/full/default.nix | 9 | ||||
| -rw-r--r-- | templates/full/flake.nix | 30 | ||||
| -rw-r--r-- | templates/full/nix/default.nix | 12 | ||||
| -rw-r--r-- | templates/full/nix/derivation.nix | 1 | ||||
| -rw-r--r-- | templates/full/nix/packages.nix | 14 | ||||
| -rw-r--r-- | templates/full/nix/shell.nix | 13 | ||||
| -rw-r--r-- | templates/nixos/flake.nix | 6 | ||||
| -rw-r--r-- | templates/nixos/justfile | 7 | ||||
| -rw-r--r-- | templates/standard/default.nix (renamed from templates/basic/default.nix) | 3 | ||||
| -rw-r--r-- | templates/standard/flake.nix (renamed from templates/basic/flake.nix) | 23 |
11 files changed, 23 insertions, 100 deletions
@@ -63,9 +63,8 @@ }; in lib.mapAttrs toTemplate { - basic = "Minimal boilerplate for my Flakes"; - full = "Big template for complex Flakes (using flake-parts)"; - nixos = "minimal boilerplate for a Flake-based NixOS configuration"; + standard = "Minimal boilerplate for my Flakes"; + nixos = "Minimal boilerplate for a Flake-based NixOS configuration"; }; }; } diff --git a/templates/full/default.nix b/templates/full/default.nix deleted file mode 100644 index 6466507..0000000 --- a/templates/full/default.nix +++ /dev/null @@ -1,9 +0,0 @@ -(import ( - let - lock = builtins.fromJSON (builtins.readFile ./flake.lock); - in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } -) { src = ./.; }).defaultNix diff --git a/templates/full/flake.nix b/templates/full/flake.nix deleted file mode 100644 index b35fa45..0000000 --- a/templates/full/flake.nix +++ /dev/null @@ -1,30 +0,0 @@ -{ - description = ""; - - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - - flake-parts = { - url = "github:hercules-ci/flake-parts"; - inputs.nixpkgs-lib.follows = "nixpkgs"; - }; - - flake-compat = { - url = "github:edolstra/flake-compat"; - flake = false; - }; - }; - - outputs = - inputs: - inputs.flake-parts.lib.mkFlake { inherit inputs; } { - imports = [ ./nix ]; - - systems = [ - "x86_64-linux" - "aarch64-linux" - "x86_64-darwin" - "aarch64-darwin" - ]; - }; -} diff --git a/templates/full/nix/default.nix b/templates/full/nix/default.nix deleted file mode 100644 index 87d9d60..0000000 --- a/templates/full/nix/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - imports = [ - ./shell.nix - ./packages.nix - ]; - - perSystem = - { pkgs, ... }: - { - formatter = pkgs.nixfmt-rfc-style; - }; -} diff --git a/templates/full/nix/derivation.nix b/templates/full/nix/derivation.nix deleted file mode 100644 index ac18240..0000000 --- a/templates/full/nix/derivation.nix +++ /dev/null @@ -1 +0,0 @@ -{ hello }: hello diff --git a/templates/full/nix/packages.nix b/templates/full/nix/packages.nix deleted file mode 100644 index 8774a3b..0000000 --- a/templates/full/nix/packages.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ self, ... }: -{ - perSystem = - { pkgs, self', ... }: - { - package = { - hello = pkgs.callPackage ./derivation.nix { - version = self.shortRev or self.dirtyShortRev or "unknown"; - }; - - default = self'.packages.hello; - }; - }; -} diff --git a/templates/full/nix/shell.nix b/templates/full/nix/shell.nix deleted file mode 100644 index 680c875..0000000 --- a/templates/full/nix/shell.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ - perSystem = - { pkgs, self', ... }: - { - devShells = { - default = pkgs.mkShell { - packages = [ self'.formatter ]; - - inputsFrom = [ self'.packages.hello ]; - }; - }; - }; -} diff --git a/templates/nixos/flake.nix b/templates/nixos/flake.nix index 2f4f57f..f78331c 100644 --- a/templates/nixos/flake.nix +++ b/templates/nixos/flake.nix @@ -1,5 +1,5 @@ { - description = "my cool flake"; + description = "My cool Nix Flake"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; @@ -14,6 +14,7 @@ { self, nixpkgs, ... }@inputs: let inherit (nixpkgs) lib; + systems = [ "x86_64-linux" "aarch64-linux" @@ -22,7 +23,7 @@ ]; forAllSystems = lib.genAttrs systems; - nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system}); + nixpkgsFor = nixpkgs.legacyPackages; in { nixosConfigurations.myComputer = nixpkgs.lib.nixosSystem { @@ -43,6 +44,7 @@ packages = [ pkgs.fzf pkgs.just + # Lets you run `nixfmt` to format all of your files self.formatter.${system} ]; diff --git a/templates/nixos/justfile b/templates/nixos/justfile index a6f8655..5b524fb 100644 --- a/templates/nixos/justfile +++ b/templates/nixos/justfile @@ -1,5 +1,5 @@ -alias b := boot -alias s := switch +alias bo := boot +alias bu := build alias sw := switch alias t := test @@ -15,6 +15,9 @@ rebuild subcmd *args="": # Switch to your new configuration when you reboot boot *args="": (rebuild "boot" args) +# Build your new configuration +build *args="": (rebuild "build" args) + # Immediately switch to your new configuration switch *args="": (rebuild "switch" args) diff --git a/templates/basic/default.nix b/templates/standard/default.nix index 16b3594..b782208 100644 --- a/templates/basic/default.nix +++ b/templates/standard/default.nix @@ -4,10 +4,9 @@ config = { }; overlays = [ ]; }, - lib ? pkgs.lib, nixpkgs ? <nixpkgs>, system ? builtins.currentSystem, }: { - inherit (pkgs) lib; + inherit (pkgs) hello; } diff --git a/templates/basic/flake.nix b/templates/standard/flake.nix index 86efae0..9c80e4b 100644 --- a/templates/basic/flake.nix +++ b/templates/standard/flake.nix @@ -1,14 +1,13 @@ { description = ""; - inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; - }; + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; outputs = { self, nixpkgs }: let inherit (nixpkgs) lib; + systems = [ "x86_64-linux" "aarch64-linux" @@ -17,20 +16,21 @@ ]; forAllSystems = lib.genAttrs systems; - nixpkgsFor = forAllSystems (system: nixpkgs.legacyPackages.${system}); + nixpkgsFor = nixpkgs.legacyPackages; in { checks = forAllSystems ( system: let pkgs = nixpkgsFor.${system}; + + mkCheck = + name: deps: script: + pkgs.runCommand name { nativeBuildInputs = deps; } script; in { - nixfmt = pkgs.runCommand "check-nixfmt" '' - cd ${self} - - echo "Running nixfmt..." - ${lib.getExe self.formatter.${system}}--check . + nixfmt = mkCheck "check-nixfmt" [ pkgs.nixfmt-rfc-style ] '' + nixfmt --check ${self} touch $out ''; @@ -56,15 +56,14 @@ packages = forAllSystems ( system: let - pkgs = import ./. { - inherit system nixpkgs lib; + pkgs = import ./default.nix { pkgs = nixpkgsFor.${system}; }; isAvailable = lib.meta.availableOn { inherit system; }; pkgs' = lib.filterAttrs (_: isAvailable) pkgs; in - pkgs // { default = pkgs'.hello; } + pkgs // { default = pkgs'.hello or pkgs.emptyFile; } ); }; } |
