Compare commits

..

No commits in common. "606cd8cf84f2d07cc26fbce286161f9765bfd37b" and "84fc1601c572ce10fada687d7bbae068ccd537b6" have entirely different histories.

32 changed files with 104 additions and 202 deletions

View file

@ -60,27 +60,6 @@
"type": "github" "type": "github"
} }
}, },
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1677714448,
"narHash": "sha256-Hq8qLs8xFu28aDjytfxjdC96bZ6pds21Yy09mSC156I=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "dc531e3a9ce757041e1afaff8ee932725ca60002",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"ref": "main",
"repo": "flake-parts",
"type": "github"
}
},
"futils": { "futils": {
"locked": { "locked": {
"lastModified": 1678901627, "lastModified": 1678901627,
@ -206,7 +185,6 @@
"root": { "root": {
"inputs": { "inputs": {
"agenix": "agenix", "agenix": "agenix",
"flake-parts": "flake-parts",
"futils": "futils", "futils": "futils",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",

View file

@ -11,16 +11,6 @@
}; };
}; };
flake-parts = {
type = "github";
owner = "hercules-ci";
repo = "flake-parts";
ref = "main";
inputs = {
nixpkgs-lib.follows = "nixpkgs";
};
};
futils = { futils = {
type = "github"; type = "github";
owner = "numtide"; owner = "numtide";
@ -70,7 +60,6 @@
inputs @ inputs @
{ self { self
, agenix , agenix
, flake-parts
, futils , futils
, home-manager , home-manager
, nixpkgs , nixpkgs

View file

@ -1,9 +0,0 @@
{ inputs, ... }:
{
perSystem = { self', ... }: {
apps = {
diff-flake = inputs.futils.lib.mkApp { drv = self'.packages.diff-flake; };
default = self'.apps.diff-flake;
};
};
}

View file

@ -1,24 +1,16 @@
{ self, inputs, ... }: { self, pre-commit-hooks, ... }:
system:
{ {
imports = [ pre-commit = pre-commit-hooks.lib.${system}.run {
inputs.pre-commit-hooks.flakeModule src = self;
];
perSystem = { system, ... }: { hooks = {
pre-commit = { nixpkgs-fmt = {
# Add itself to `nix flake check` enable = true;
check.enable = true; };
settings = { shellcheck = {
hooks = { enable = true;
nixpkgs-fmt = {
enable = true;
};
shellcheck = {
enable = true;
};
};
}; };
}; };
}; };

View file

@ -1,5 +1,4 @@
{ self { self
, flake-parts
, futils , futils
, home-manager , home-manager
, nixpkgs , nixpkgs
@ -9,7 +8,7 @@
let let
inherit (self) lib; inherit (self) lib;
inherit (futils.lib) system; inherit (futils.lib) eachSystem system;
mySystems = [ mySystems = [
system.aarch64-darwin system.aarch64-darwin
@ -17,18 +16,65 @@ let
system.x86_64-darwin system.x86_64-darwin
system.x86_64-linux system.x86_64-linux
]; ];
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = mySystems;
imports = [ eachMySystem = eachSystem mySystems;
./apps.nix
./checks.nix systemDependant = system: {
./dev-shells.nix apps = {
./home-manager.nix diff-flake = futils.lib.mkApp { drv = self.packages.${system}.diff-flake; };
./lib.nix default = self.apps.${system}.diff-flake;
./nixos.nix };
./overlays.nix
./packages.nix checks = import ./checks.nix inputs system;
];
} devShells = import ./dev-shells.nix inputs system;
packages = import ./packages.nix inputs system;
# Work-around for https://github.com/nix-community/home-manager/issues/3075
legacyPackages = {
homeConfigurations = {
ambroisie = home-manager.lib.homeManagerConfiguration {
# Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
# [1]: https://github.com/nix-community/home-manager/issues/2954
pkgs = import nixpkgs {
inherit system;
overlays = (lib.attrValues self.overlays) ++ [
nur.overlay
];
};
modules = [
"${self}/home"
{
# The basics
home.username = "ambroisie";
home.homeDirectory = "/home/ambroisie";
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# This is a generic linux install
targets.genericLinux.enable = true;
}
];
extraSpecialArgs = {
# Inject inputs to use them in global registry
inherit inputs;
};
};
};
};
};
systemIndependant = {
lib = import ./lib.nix inputs;
overlays = import ./overlays.nix inputs;
nixosConfigurations = import ./nixos.nix inputs;
};
in
(eachMySystem systemDependant) // systemIndependant

View file

@ -1,19 +1,17 @@
{ inputs, ... }: { self, nixpkgs, ... }:
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{ {
perSystem = { self', config, pkgs, ... }: { default = pkgs.mkShell {
devShells = { name = "NixOS-config";
default = pkgs.mkShell {
name = "NixOS-config";
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
gitAndTools.pre-commit gitAndTools.pre-commit
nixpkgs-fmt nixpkgs-fmt
]; ];
shellHook = '' inherit (self.checks.${system}.pre-commit) shellHook;
${config.pre-commit.installationScript}
'';
};
};
}; };
} }

View file

@ -1,61 +0,0 @@
{ self, inputs, lib, ... }:
let
defaultModules = [
# Include generic settings
"${self}/home"
{
# Basic user information defaults
home.username = lib.mkDefault "ambroisie";
home.homeDirectory = lib.mkDefault "/home/ambroisie";
# Make it a Linux installation by default
targets.genericLinux.enable = lib.mkDefault true;
# Enable home-manager
programs.home-manager.enable = true;
}
];
mkHome = name: system: inputs.home-manager.lib.homeManagerConfiguration {
# Work-around for home-manager
# * not letting me set `lib` as an extraSpecialArgs
# * not respecting `nixpkgs.overlays` [1]
# [1]: https://github.com/nix-community/home-manager/issues/2954
pkgs = import inputs.nixpkgs {
inherit system;
overlays = (lib.attrValues self.overlays) ++ [
inputs.nur.overlay
];
};
modules = defaultModules ++ [
"${self}/hosts/homes/${name}"
];
extraSpecialArgs = {
# Inject inputs to use them in global registry
inherit inputs;
};
};
hosts = {
"ambroisie@ambroisie" = "x86_64-linux"; # Unfortunate naming here...
};
in
{
perSystem = { system, ... }: {
# Work-around for https://github.com/nix-community/home-manager/issues/3075
legacyPackages = {
homeConfigurations =
let
filteredHosts = lib.filterAttrs (_: v: v == system) hosts;
allHosts = filteredHosts // {
# Default configuration
ambroisie = system;
};
in
lib.mapAttrs mkHome allHosts;
};
};
}

View file

@ -1,11 +1,7 @@
{ self, inputs, ... }: { self, nixpkgs, ... } @ inputs:
let let
inherit (inputs) nixpkgs;
lib = nixpkgs.lib.extend (final: _: { lib = nixpkgs.lib.extend (final: _: {
my = import "${self}/lib" { inherit inputs; pkgs = nixpkgs; lib = final; }; my = import "${self}/lib" { inherit inputs; pkgs = nixpkgs; lib = final; };
}); });
in in
{ lib
flake.lib = lib;
}

View file

@ -1,4 +1,4 @@
{ self, inputs, ... }: { self, nixpkgs, nur, ... } @ inputs:
let let
inherit (self) lib; inherit (self) lib;
@ -9,7 +9,7 @@ let
}) })
{ {
nixpkgs.overlays = (lib.attrValues self.overlays) ++ [ nixpkgs.overlays = (lib.attrValues self.overlays) ++ [
inputs.nur.overlay nur.overlay
]; ];
} }
# Include generic settings # Include generic settings
@ -21,7 +21,7 @@ let
buildHost = name: system: lib.nixosSystem { buildHost = name: system: lib.nixosSystem {
inherit system; inherit system;
modules = defaultModules ++ [ modules = defaultModules ++ [
"${self}/hosts/nixos/${name}" "${self}/machines/${name}"
]; ];
specialArgs = { specialArgs = {
# Use my extended lib in NixOS configuration # Use my extended lib in NixOS configuration
@ -31,9 +31,7 @@ let
}; };
}; };
in in
{ lib.mapAttrs buildHost {
flake.nixosConfigurations = lib.mapAttrs buildHost { aramis = "x86_64-linux";
aramis = "x86_64-linux"; porthos = "x86_64-linux";
porthos = "x86_64-linux";
};
} }

View file

@ -1,4 +1,5 @@
{ self, ... }: { self, ... }:
let let
default-overlays = import "${self}/overlays"; default-overlays = import "${self}/overlays";
@ -12,6 +13,4 @@ let
}; };
}; };
in in
{ default-overlays // additional-overlays
flake.overlays = default-overlays // additional-overlays;
}

View file

@ -1,13 +1,10 @@
{ self, inputs, ... }: { self, futils, nixpkgs, ... }:
{ system:
perSystem = { pkgs, system, ... }: { let
packages = inherit (futils.lib) filterPackages flattenTree;
let pkgs = nixpkgs.legacyPackages.${system};
inherit (inputs.futils.lib) filterPackages flattenTree; packages = import "${self}/pkgs" { inherit pkgs; };
packages = import "${self}/pkgs" { inherit pkgs; }; flattenedPackages = flattenTree packages;
flattenedPackages = flattenTree packages; finalPackages = filterPackages system flattenedPackages;
finalPackages = filterPackages system flattenedPackages; in
in finalPackages
finalPackages;
};
}

View file

@ -1,5 +0,0 @@
# Default home-manager configuration
{ ... }:
{
# Default configuration, nothing to do
}

View file

@ -1,16 +0,0 @@
# Google Cloudtop configuration
{ ... }:
{
# Google specific configuration
home.homeDirectory = "/usr/local/google/home/ambroisie";
home.sessionVariables = {
# Some tooling (e.g: SSH) need to use this library
LD_PRELOAD = "/lib/x86_64-linux-gnu/libnss_cache.so.2\${LD_PRELOAD:+:}$LD_PRELOAD";
};
my.home = {
# I don't need a GPG agent
gpg.enable = false;
};
}