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"
}
},
"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": {
"locked": {
"lastModified": 1678901627,
@ -206,7 +185,6 @@
"root": {
"inputs": {
"agenix": "agenix",
"flake-parts": "flake-parts",
"futils": "futils",
"home-manager": "home-manager",
"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 = {
type = "github";
owner = "numtide";
@ -70,7 +60,6 @@
inputs @
{ self
, agenix
, flake-parts
, futils
, home-manager
, 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,15 +1,9 @@
{ self, inputs, ... }:
{ self, pre-commit-hooks, ... }:
system:
{
imports = [
inputs.pre-commit-hooks.flakeModule
];
pre-commit = pre-commit-hooks.lib.${system}.run {
src = self;
perSystem = { system, ... }: {
pre-commit = {
# Add itself to `nix flake check`
check.enable = true;
settings = {
hooks = {
nixpkgs-fmt = {
enable = true;
@ -20,6 +14,4 @@
};
};
};
};
};
}

View file

@ -1,5 +1,4 @@
{ self
, flake-parts
, futils
, home-manager
, nixpkgs
@ -9,7 +8,7 @@
let
inherit (self) lib;
inherit (futils.lib) system;
inherit (futils.lib) eachSystem system;
mySystems = [
system.aarch64-darwin
@ -17,18 +16,65 @@ let
system.x86_64-darwin
system.x86_64-linux
];
in
flake-parts.lib.mkFlake { inherit inputs; } {
systems = mySystems;
imports = [
./apps.nix
./checks.nix
./dev-shells.nix
./home-manager.nix
./lib.nix
./nixos.nix
./overlays.nix
./packages.nix
eachMySystem = eachSystem mySystems;
systemDependant = system: {
apps = {
diff-flake = futils.lib.mkApp { drv = self.packages.${system}.diff-flake; };
default = self.apps.${system}.diff-flake;
};
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,7 +1,9 @@
{ inputs, ... }:
{ self, nixpkgs, ... }:
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
perSystem = { self', config, pkgs, ... }: {
devShells = {
default = pkgs.mkShell {
name = "NixOS-config";
@ -10,10 +12,6 @@
nixpkgs-fmt
];
shellHook = ''
${config.pre-commit.installationScript}
'';
};
};
inherit (self.checks.${system}.pre-commit) shellHook;
};
}

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
inherit (inputs) nixpkgs;
lib = nixpkgs.lib.extend (final: _: {
my = import "${self}/lib" { inherit inputs; pkgs = nixpkgs; lib = final; };
});
in
{
flake.lib = lib;
}
lib

View file

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

View file

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

View file

@ -1,13 +1,10 @@
{ self, inputs, ... }:
{
perSystem = { pkgs, system, ... }: {
packages =
let
inherit (inputs.futils.lib) filterPackages flattenTree;
{ 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;
};
}
in
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;
};
}