Compare commits

...

11 commits

Author SHA1 Message Date
Bruno BELANYI d14f96d584 flake: move 'nixosConfigurations' to 'flake/'
All checks were successful
continuous-integration/drone/push Build is passing
2023-03-07 12:34:46 +00:00
Bruno BELANYI 40fff4b13a flake: move 'packages' to 'flake/' 2023-03-07 12:34:46 +00:00
Bruno BELANYI 1ae2bca445 flake: move 'devShells' to 'flake/' 2023-03-07 12:34:46 +00:00
Bruno BELANYI fc02519c4f flake: move 'checks' to 'flake/' 2023-03-07 12:34:46 +00:00
Bruno BELANYI 90d1d81983 flake: move 'lib' to 'flake/' 2023-03-07 12:34:46 +00:00
Bruno BELANYI 819ce1a320 flake: move 'overlays' to 'flake/' 2023-03-07 12:34:46 +00:00
Bruno BELANYI b9083244ed flake: add 'aarch64-darwin' again
I don't get an error during `nix flake check` anymore.

This reverts commit 8a556585af.
2023-03-07 12:34:46 +00:00
Bruno BELANYI 04734c8bd2 pkgs: ff2mpv-go: fix 'vendorHash' 2023-03-07 12:34:46 +00:00
Bruno BELANYI 8b7198d7e7 direnv: always use 'nix-direnv' 2023-03-07 11:51:04 +00:00
Bruno BELANYI 453e5a925a direnv: remove nix evaluation hack 2023-03-07 11:50:34 +00:00
Bruno BELANYI 3ed5e40285 flake: expose 'lib' attribute
This exposes `lib.my` which contains my custom library functions, as
well as the entirety of the nixpkgs library.
2023-03-07 11:05:07 +00:00
9 changed files with 122 additions and 87 deletions

13
.envrc
View file

@ -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"

View file

@ -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
View 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
View 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
View 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
View 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
View 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
View 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

View file

@ -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