Compare commits
11 commits
068faea1e2
...
d14f96d584
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | d14f96d584 | ||
Bruno BELANYI | 40fff4b13a | ||
Bruno BELANYI | 1ae2bca445 | ||
Bruno BELANYI | fc02519c4f | ||
Bruno BELANYI | 90d1d81983 | ||
Bruno BELANYI | 819ce1a320 | ||
Bruno BELANYI | b9083244ed | ||
Bruno BELANYI | 04734c8bd2 | ||
Bruno BELANYI | 8b7198d7e7 | ||
Bruno BELANYI | 453e5a925a | ||
Bruno BELANYI | 3ed5e40285 |
13
.envrc
13
.envrc
|
@ -1,9 +1,10 @@
|
|||
use_flake() {
|
||||
watch_file flake.nix
|
||||
watch_file flake.lock
|
||||
eval "$(nix print-dev-env)"
|
||||
}
|
||||
if ! has nix_direnv_version || ! nix_direnv_version 2.2.1; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/2.2.1/direnvrc" "sha256-zelF0vLbEl5uaqrfIzbgNzJWGmLzCmYAkInj/LNxvKs="
|
||||
fi
|
||||
|
||||
ulimit -s unlimited # Bypass current bug in `nix` flakes evaluation
|
||||
use flake
|
||||
|
||||
watch_file ./flake/checks.nix
|
||||
watch_file ./flake/dev-shells.nix
|
||||
|
||||
eval "$shellHooks"
|
||||
|
|
90
flake.nix
90
flake.nix
|
@ -67,9 +67,12 @@
|
|||
, pre-commit-hooks
|
||||
}:
|
||||
let
|
||||
inherit (self) lib;
|
||||
|
||||
inherit (futils.lib) eachSystem system;
|
||||
|
||||
mySystems = [
|
||||
system.aarch64-darwin
|
||||
system.aarch64-linux
|
||||
system.x86_64-darwin
|
||||
system.x86_64-linux
|
||||
|
@ -77,87 +80,20 @@
|
|||
|
||||
eachMySystem = eachSystem mySystems;
|
||||
|
||||
lib = nixpkgs.lib.extend (self: super: {
|
||||
my = import ./lib { inherit inputs; pkgs = nixpkgs; lib = self; };
|
||||
});
|
||||
|
||||
defaultModules = [
|
||||
({ ... }: {
|
||||
# Let 'nixos-version --json' know about the Git revision
|
||||
system.configurationRevision = self.rev or "dirty";
|
||||
})
|
||||
{
|
||||
nixpkgs.overlays = (lib.attrValues self.overlays) ++ [
|
||||
nur.overlay
|
||||
];
|
||||
}
|
||||
# Include generic settings
|
||||
./modules
|
||||
# Include bundles of settings
|
||||
./profiles
|
||||
];
|
||||
|
||||
buildHost = name: system: lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = defaultModules ++ [
|
||||
(./. + "/machines/${name}")
|
||||
];
|
||||
specialArgs = {
|
||||
# Use my extended lib in NixOS configuration
|
||||
inherit lib;
|
||||
# Inject inputs to use them in global registry
|
||||
inherit inputs;
|
||||
};
|
||||
};
|
||||
in
|
||||
eachMySystem
|
||||
(system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
rec {
|
||||
apps = {
|
||||
diff-flake = futils.lib.mkApp { drv = packages.diff-flake; };
|
||||
default = apps.diff-flake;
|
||||
};
|
||||
|
||||
checks = {
|
||||
pre-commit = pre-commit-hooks.lib.${system}.run {
|
||||
src = ./.;
|
||||
checks = import ./flake/checks.nix inputs system;
|
||||
|
||||
hooks = {
|
||||
nixpkgs-fmt = {
|
||||
enable = true;
|
||||
};
|
||||
devShells = import ./flake/dev-shells.nix inputs system;
|
||||
|
||||
shellcheck = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
name = "NixOS-config";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
gitAndTools.pre-commit
|
||||
nixpkgs-fmt
|
||||
];
|
||||
|
||||
inherit (self.checks.${system}.pre-commit) shellHook;
|
||||
};
|
||||
};
|
||||
|
||||
packages =
|
||||
let
|
||||
inherit (futils.lib) filterPackages flattenTree;
|
||||
packages = import ./pkgs { inherit pkgs; };
|
||||
flattenedPackages = flattenTree packages;
|
||||
finalPackages = filterPackages system flattenedPackages;
|
||||
in
|
||||
finalPackages;
|
||||
packages = import ./flake/packages.nix inputs system;
|
||||
|
||||
# Work-around for https://github.com/nix-community/home-manager/issues/3075
|
||||
legacyPackages = {
|
||||
|
@ -196,16 +132,10 @@
|
|||
};
|
||||
};
|
||||
}) // {
|
||||
overlays = import ./overlays // {
|
||||
lib = final: prev: { inherit lib; };
|
||||
pkgs = final: prev: {
|
||||
ambroisie = prev.recurseIntoAttrs (import ./pkgs { pkgs = prev; });
|
||||
};
|
||||
};
|
||||
lib = import ./flake/lib.nix inputs;
|
||||
|
||||
nixosConfigurations = lib.mapAttrs buildHost {
|
||||
aramis = "x86_64-linux";
|
||||
porthos = "x86_64-linux";
|
||||
};
|
||||
overlays = import ./flake/overlays.nix inputs;
|
||||
|
||||
nixosConfigurations = import ./flake/nixos.nix inputs;
|
||||
};
|
||||
}
|
||||
|
|
17
flake/checks.nix
Normal file
17
flake/checks.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ self, pre-commit-hooks, ... }:
|
||||
system:
|
||||
{
|
||||
pre-commit = pre-commit-hooks.lib.${system}.run {
|
||||
src = self;
|
||||
|
||||
hooks = {
|
||||
nixpkgs-fmt = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
shellcheck = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
17
flake/dev-shells.nix
Normal file
17
flake/dev-shells.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ self, nixpkgs, ... }:
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
name = "NixOS-config";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
gitAndTools.pre-commit
|
||||
nixpkgs-fmt
|
||||
];
|
||||
|
||||
inherit (self.checks.${system}.pre-commit) shellHook;
|
||||
};
|
||||
}
|
7
flake/lib.nix
Normal file
7
flake/lib.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
{ self, nixpkgs, ... } @ inputs:
|
||||
let
|
||||
lib = nixpkgs.lib.extend (final: _: {
|
||||
my = import "${self}/lib" { inherit inputs; pkgs = nixpkgs; lib = final; };
|
||||
});
|
||||
in
|
||||
lib
|
37
flake/nixos.nix
Normal file
37
flake/nixos.nix
Normal file
|
@ -0,0 +1,37 @@
|
|||
{ self, nixpkgs, nur, ... } @ inputs:
|
||||
let
|
||||
inherit (self) lib;
|
||||
|
||||
defaultModules = [
|
||||
({ ... }: {
|
||||
# Let 'nixos-version --json' know about the Git revision
|
||||
system.configurationRevision = self.rev or "dirty";
|
||||
})
|
||||
{
|
||||
nixpkgs.overlays = (lib.attrValues self.overlays) ++ [
|
||||
nur.overlay
|
||||
];
|
||||
}
|
||||
# Include generic settings
|
||||
"${self}/modules"
|
||||
# Include bundles of settings
|
||||
"${self}/profiles"
|
||||
];
|
||||
|
||||
buildHost = name: system: lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = defaultModules ++ [
|
||||
"${self}/machines/${name}"
|
||||
];
|
||||
specialArgs = {
|
||||
# Use my extended lib in NixOS configuration
|
||||
inherit lib;
|
||||
# Inject inputs to use them in global registry
|
||||
inherit inputs;
|
||||
};
|
||||
};
|
||||
in
|
||||
lib.mapAttrs buildHost {
|
||||
aramis = "x86_64-linux";
|
||||
porthos = "x86_64-linux";
|
||||
}
|
16
flake/overlays.nix
Normal file
16
flake/overlays.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
{ self, ... }:
|
||||
|
||||
let
|
||||
default-overlays = import "${self}/overlays";
|
||||
|
||||
additional-overlays = {
|
||||
# Expose my expanded library
|
||||
lib = final: prev: { inherit (self) lib; };
|
||||
|
||||
# Expose my custom packages
|
||||
pkgs = final: prev: {
|
||||
ambroisie = prev.recurseIntoAttrs (import "${self}/pkgs" { pkgs = prev; });
|
||||
};
|
||||
};
|
||||
in
|
||||
default-overlays // additional-overlays
|
10
flake/packages.nix
Normal file
10
flake/packages.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ self, futils, nixpkgs, ... }:
|
||||
system:
|
||||
let
|
||||
inherit (futils.lib) filterPackages flattenTree;
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
packages = import "${self}/pkgs" { inherit pkgs; };
|
||||
flattenedPackages = flattenTree packages;
|
||||
finalPackages = filterPackages system flattenedPackages;
|
||||
in
|
||||
finalPackages
|
|
@ -9,7 +9,7 @@ buildGoModule rec {
|
|||
sha256 = "sha256-e/AuOA3isFTyBf97Zwtr16yo49UdYzvktV5PKB/eH/s=";
|
||||
};
|
||||
|
||||
vendorSha256 = "sha256-pQpattmS9VmO3ZIQUFn66az8GSmB4IvYhTTCFn6SUmo=";
|
||||
vendorHash = null;
|
||||
|
||||
postPatch = ''
|
||||
sed -i -e 's,"mpv","${mpv}/bin/mpv",' ff2mpv.go
|
||||
|
|
Loading…
Reference in a new issue