Compare commits
15 commits
84fc1601c5
...
606cd8cf84
Author | SHA1 | Date | |
---|---|---|---|
Bruno BELANYI | 606cd8cf84 | ||
Bruno BELANYI | a046569743 | ||
Bruno BELANYI | 2fb3d0f9cf | ||
Bruno BELANYI | eac628963a | ||
Bruno BELANYI | 8657774d06 | ||
Bruno BELANYI | c82eb57070 | ||
Bruno BELANYI | 59b1ab59dd | ||
Bruno BELANYI | ec036255ad | ||
Bruno BELANYI | 2b969f7726 | ||
Bruno BELANYI | e1e6c39bf1 | ||
Bruno BELANYI | 730e4abf17 | ||
Bruno BELANYI | b2f3bc955c | ||
Bruno BELANYI | a88c99b9d7 | ||
Bruno BELANYI | 922c6e75ca | ||
Bruno BELANYI | 92438d35f6 |
22
flake.lock
22
flake.lock
|
@ -60,6 +60,27 @@
|
|||
"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,
|
||||
|
@ -185,6 +206,7 @@
|
|||
"root": {
|
||||
"inputs": {
|
||||
"agenix": "agenix",
|
||||
"flake-parts": "flake-parts",
|
||||
"futils": "futils",
|
||||
"home-manager": "home-manager",
|
||||
"nixpkgs": "nixpkgs",
|
||||
|
|
11
flake.nix
11
flake.nix
|
@ -11,6 +11,16 @@
|
|||
};
|
||||
};
|
||||
|
||||
flake-parts = {
|
||||
type = "github";
|
||||
owner = "hercules-ci";
|
||||
repo = "flake-parts";
|
||||
ref = "main";
|
||||
inputs = {
|
||||
nixpkgs-lib.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
futils = {
|
||||
type = "github";
|
||||
owner = "numtide";
|
||||
|
@ -60,6 +70,7 @@
|
|||
inputs @
|
||||
{ self
|
||||
, agenix
|
||||
, flake-parts
|
||||
, futils
|
||||
, home-manager
|
||||
, nixpkgs
|
||||
|
|
9
flake/apps.nix
Normal file
9
flake/apps.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ inputs, ... }:
|
||||
{
|
||||
perSystem = { self', ... }: {
|
||||
apps = {
|
||||
diff-flake = inputs.futils.lib.mkApp { drv = self'.packages.diff-flake; };
|
||||
default = self'.apps.diff-flake;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,16 +1,24 @@
|
|||
{ self, pre-commit-hooks, ... }:
|
||||
system:
|
||||
{ self, inputs, ... }:
|
||||
{
|
||||
pre-commit = pre-commit-hooks.lib.${system}.run {
|
||||
src = self;
|
||||
imports = [
|
||||
inputs.pre-commit-hooks.flakeModule
|
||||
];
|
||||
|
||||
hooks = {
|
||||
nixpkgs-fmt = {
|
||||
enable = true;
|
||||
};
|
||||
perSystem = { system, ... }: {
|
||||
pre-commit = {
|
||||
# Add itself to `nix flake check`
|
||||
check.enable = true;
|
||||
|
||||
shellcheck = {
|
||||
enable = true;
|
||||
settings = {
|
||||
hooks = {
|
||||
nixpkgs-fmt = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
shellcheck = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ self
|
||||
, flake-parts
|
||||
, futils
|
||||
, home-manager
|
||||
, nixpkgs
|
||||
|
@ -8,7 +9,7 @@
|
|||
let
|
||||
inherit (self) lib;
|
||||
|
||||
inherit (futils.lib) eachSystem system;
|
||||
inherit (futils.lib) system;
|
||||
|
||||
mySystems = [
|
||||
system.aarch64-darwin
|
||||
|
@ -16,65 +17,18 @@ let
|
|||
system.x86_64-darwin
|
||||
system.x86_64-linux
|
||||
];
|
||||
|
||||
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
|
||||
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
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
{ self, nixpkgs, ... }:
|
||||
system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{ inputs, ... }:
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
name = "NixOS-config";
|
||||
perSystem = { self', config, pkgs, ... }: {
|
||||
devShells = {
|
||||
default = pkgs.mkShell {
|
||||
name = "NixOS-config";
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
gitAndTools.pre-commit
|
||||
nixpkgs-fmt
|
||||
];
|
||||
nativeBuildInputs = with pkgs; [
|
||||
gitAndTools.pre-commit
|
||||
nixpkgs-fmt
|
||||
];
|
||||
|
||||
inherit (self.checks.${system}.pre-commit) shellHook;
|
||||
shellHook = ''
|
||||
${config.pre-commit.installationScript}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
61
flake/home-manager.nix
Normal file
61
flake/home-manager.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{ 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;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,7 +1,11 @@
|
|||
{ self, nixpkgs, ... } @ inputs:
|
||||
{ self, inputs, ... }:
|
||||
let
|
||||
inherit (inputs) nixpkgs;
|
||||
|
||||
lib = nixpkgs.lib.extend (final: _: {
|
||||
my = import "${self}/lib" { inherit inputs; pkgs = nixpkgs; lib = final; };
|
||||
});
|
||||
in
|
||||
lib
|
||||
{
|
||||
flake.lib = lib;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{ self, nixpkgs, nur, ... } @ inputs:
|
||||
{ self, inputs, ... }:
|
||||
let
|
||||
inherit (self) lib;
|
||||
|
||||
|
@ -9,7 +9,7 @@ let
|
|||
})
|
||||
{
|
||||
nixpkgs.overlays = (lib.attrValues self.overlays) ++ [
|
||||
nur.overlay
|
||||
inputs.nur.overlay
|
||||
];
|
||||
}
|
||||
# Include generic settings
|
||||
|
@ -21,7 +21,7 @@ let
|
|||
buildHost = name: system: lib.nixosSystem {
|
||||
inherit system;
|
||||
modules = defaultModules ++ [
|
||||
"${self}/machines/${name}"
|
||||
"${self}/hosts/nixos/${name}"
|
||||
];
|
||||
specialArgs = {
|
||||
# Use my extended lib in NixOS configuration
|
||||
|
@ -31,7 +31,9 @@ let
|
|||
};
|
||||
};
|
||||
in
|
||||
lib.mapAttrs buildHost {
|
||||
aramis = "x86_64-linux";
|
||||
porthos = "x86_64-linux";
|
||||
{
|
||||
flake.nixosConfigurations = lib.mapAttrs buildHost {
|
||||
aramis = "x86_64-linux";
|
||||
porthos = "x86_64-linux";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
{ self, ... }:
|
||||
|
||||
let
|
||||
default-overlays = import "${self}/overlays";
|
||||
|
||||
|
@ -13,4 +12,6 @@ let
|
|||
};
|
||||
};
|
||||
in
|
||||
default-overlays // additional-overlays
|
||||
{
|
||||
flake.overlays = default-overlays // additional-overlays;
|
||||
}
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
{ 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
|
||||
{ self, inputs, ... }:
|
||||
{
|
||||
perSystem = { pkgs, system, ... }: {
|
||||
packages =
|
||||
let
|
||||
inherit (inputs.futils.lib) filterPackages flattenTree;
|
||||
packages = import "${self}/pkgs" { inherit pkgs; };
|
||||
flattenedPackages = flattenTree packages;
|
||||
finalPackages = filterPackages system flattenedPackages;
|
||||
in
|
||||
finalPackages;
|
||||
};
|
||||
}
|
||||
|
|
5
hosts/homes/ambroisie/default.nix
Normal file
5
hosts/homes/ambroisie/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Default home-manager configuration
|
||||
{ ... }:
|
||||
{
|
||||
# Default configuration, nothing to do
|
||||
}
|
16
hosts/homes/ambroisie@ambroisie/default.nix
Normal file
16
hosts/homes/ambroisie@ambroisie/default.nix
Normal file
|
@ -0,0 +1,16 @@
|
|||
# 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;
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue