mirror of
https://github.com/davegallant/nix-config
synced 2025-08-05 10:33:39 +00:00
Add pre-commit hooks
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,2 +1 @@
|
||||
# avoid weird recursion problems
|
||||
.dotfiles
|
||||
.pre-commit-config.yaml
|
||||
|
@@ -9,7 +9,7 @@ This repo stores nix to manage my machines. The initial structure was inspired b
|
||||
```console
|
||||
$ git clone git@github.com:davegallant/nix-config.git
|
||||
$ cd nix-config
|
||||
$ sudo ./nixos-rebuild switch
|
||||
$ sudo ./nixos-rebuild.sh switch
|
||||
```
|
||||
|
||||
## Update
|
||||
|
12
default.nix
Normal file
12
default.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
let
|
||||
nix-pre-commit-hooks = import (builtins.fetchTarball
|
||||
"https://github.com/cachix/pre-commit-hooks.nix/tarball/master");
|
||||
in {
|
||||
pre-commit-check = nix-pre-commit-hooks.run {
|
||||
src = ./.;
|
||||
hooks = {
|
||||
shellcheck.enable = true;
|
||||
nixfmt.enable = true;
|
||||
};
|
||||
};
|
||||
}
|
101
flake.nix
101
flake.nix
@@ -7,62 +7,61 @@
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-20.09";
|
||||
nixpkgs-master.url = "github:NixOS/nixpkgs";
|
||||
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
nixos-hardware.url = github:NixOS/nixos-hardware/master;
|
||||
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
|
||||
};
|
||||
|
||||
outputs = { self, home-manager, nixpkgs, nixpkgs-master, nixpkgs-unstable, nixos-hardware }: {
|
||||
nixosConfigurations = let
|
||||
defaultModules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
./modules/g810-led.nix
|
||||
./main/fonts.nix
|
||||
./main/general.nix
|
||||
./main/kernel.nix
|
||||
./main/packages.nix
|
||||
./main/printing.nix
|
||||
outputs = { self, home-manager, nixpkgs, nixpkgs-master, nixpkgs-unstable
|
||||
, nixos-hardware }: {
|
||||
nixosConfigurations = let
|
||||
defaultModules = [
|
||||
home-manager.nixosModules.home-manager
|
||||
./modules/g810-led.nix
|
||||
./main/fonts.nix
|
||||
./main/general.nix
|
||||
./main/kernel.nix
|
||||
./main/packages.nix
|
||||
./main/printing.nix
|
||||
|
||||
({ config, lib, lib', ... }: {
|
||||
config = {
|
||||
_module.args = {
|
||||
lib' = lib // import ./lib { inherit config lib; };
|
||||
master = lib'.pkgsImport nixpkgs-master;
|
||||
unstable = lib'.pkgsImport nixpkgs-unstable;
|
||||
({ config, lib, lib', ... }: {
|
||||
config = {
|
||||
_module.args = {
|
||||
lib' = lib // import ./lib { inherit config lib; };
|
||||
master = lib'.pkgsImport nixpkgs-master;
|
||||
unstable = lib'.pkgsImport nixpkgs-unstable;
|
||||
};
|
||||
|
||||
nix.registry = {
|
||||
nixpkgs.flake = nixpkgs;
|
||||
nixpkgs-unstable.flake = nixpkgs-unstable;
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [ (import ./overlays) ];
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users.dave.imports = [ ./home/default.nix ];
|
||||
};
|
||||
};
|
||||
|
||||
nix.registry = {
|
||||
nixpkgs.flake = nixpkgs;
|
||||
nixpkgs-unstable.flake = nixpkgs-unstable;
|
||||
};
|
||||
|
||||
nixpkgs.overlays = [
|
||||
(import ./overlays)
|
||||
];
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
users.dave.imports = [ ./home/default.nix ];
|
||||
};
|
||||
};
|
||||
})
|
||||
];
|
||||
in {
|
||||
hephaestus = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./machines/hephaestus/configuration.nix
|
||||
./machines/hephaestus/hardware.nix
|
||||
] ++ defaultModules;
|
||||
};
|
||||
hermes = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
nixos-hardware.nixosModules.lenovo-thinkpad-t480s
|
||||
./machines/hermes/configuration.nix
|
||||
./machines/hermes/hardware.nix
|
||||
] ++ defaultModules;
|
||||
})
|
||||
];
|
||||
in {
|
||||
hephaestus = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
./machines/hephaestus/configuration.nix
|
||||
./machines/hephaestus/hardware.nix
|
||||
] ++ defaultModules;
|
||||
};
|
||||
hermes = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
nixos-hardware.nixosModules.lenovo-thinkpad-t480s
|
||||
./machines/hermes/configuration.nix
|
||||
./machines/hermes/hardware.nix
|
||||
] ++ defaultModules;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
cd "$(dirname "$0")"
|
||||
exec nixos-rebuild -I nixos-config=machines/$(hostname)/configuration.nix "$@" --flake '.#'
|
3
nixos-rebuild.sh
Executable file
3
nixos-rebuild.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
cd "$(dirname "$0")" || exit
|
||||
exec nixos-rebuild -I nixos-config="machines/$(hostname)/configuration.nix" "$@" --flake '.#'
|
Reference in New Issue
Block a user