Mutualize minimal NixOS configuration too

This commit is contained in:
Quentin Boyer 2023-03-26 15:41:53 +02:00
parent fdc6508740
commit 4fece8d5d7
8 changed files with 78 additions and 52 deletions

View file

@ -1,16 +1,15 @@
{
config,
lib,
pkgs,
...
}:
{lib, ...}:
with lib;
with builtins; {
options = {
extraInfo.email = mkOption {
type = types.nullOr types.str;
type = types.str;
description = "Email address";
default = null;
};
extraInfo.username = mkOption {
type = types.str;
description = "Username to deploy the configuration as";
};
extraInfo.inputs = {

View file

@ -77,6 +77,8 @@
neovimTraxys = inputs.nvim-traxys.packages."${system}".nvim;
roaming_proxy = inputs.roaming_proxy.defaultPackage."${system}";
};
extraInfo = import ./extra_info.nix;
in {
templates = {
rust = {
@ -87,18 +89,26 @@
packages.x86_64-linux = pkgList "x86_64-linux" nixpkgs.legacyPackages.x86_64-linux.callPackage;
hmModules = {
minimal = import ./minimal {
minimal = import ./minimal/hm.nix {
inherit inputs;
flake = self;
};
};
nixosModules = {
minimal = import ./minimal/nixos.nix {
inherit extraInfo;
};
};
overlays.x86_64-linux = final: prev: pkgList "x86_64-linux" prev.callPackage;
nixosConfigurations = {
ZeNixLaptop = nixpkgs.lib.nixosSystem rec {
system = "x86_64-linux";
modules = [
./hostconfig/ZeNixComputa/extra_info.nix
self.nixosModules.minimal
({pkgs, ...}: {
nixpkgs.overlays = [
inputs.nur.overlay
@ -121,6 +131,7 @@
...
}: {
imports = [
self.hmModules.minimal
./home.nix
./graphical.nix
./extra_info.nix
@ -128,7 +139,6 @@
./wm
./rustdev.nix
./git
self.hmModules.minimal
];
};
home-manager.extraSpecialArgs = {

View file

@ -0,0 +1,3 @@
{
extraInfo.username = "traxys";
}

View file

@ -145,7 +145,5 @@
home.file = {
".zprofile".source = ./zprofile;
};
home.stateVersion = "21.11";
};
}

56
minimal/nixos.nix Normal file
View file

@ -0,0 +1,56 @@
{extraInfo}: {
config,
pkgs,
...
}: {
imports = [extraInfo];
users.users."${config.extraInfo.username}" = {
isNormalUser = true;
home = "/home/${config.extraInfo.username}";
shell = pkgs.zsh;
};
programs.zsh.enable = true;
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "dvorak-programmer";
};
environment.pathsToLink = ["/share/zsh"];
fonts.enableDefaultFonts = true;
fonts = {
fonts = with pkgs; [
(nerdfonts.override {fonts = ["Hack"];})
dejavu_fonts
];
fontconfig = {
defaultFonts = {
serif = ["DejaVu"];
sansSerif = ["DejaVu Sans"];
monospace = ["Hack"];
};
};
};
nix = {
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
settings = {
auto-optimise-store = true;
substituters = ["https://nix-gaming.cachix.org"];
trusted-public-keys = ["nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4="];
};
};
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
}

View file

@ -20,14 +20,6 @@
# replicates the default behaviour.
networking.useDHCP = false;
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "dvorak-programmer";
};
environment.pathsToLink = ["/share/zsh"];
security.rtkit.enable = true;
services = {
tzupdate.enable = true;
@ -51,21 +43,6 @@
programs.nix-ld.enable = true;
hardware.opentabletdriver.enable = true;
fonts.enableDefaultFonts = true;
fonts = {
fonts = with pkgs; [
(nerdfonts.override {fonts = ["Hack"];})
dejavu_fonts
];
fontconfig = {
defaultFonts = {
serif = ["DejaVu"];
sansSerif = ["DejaVu Sans"];
monospace = ["Hack"];
};
};
};
boot.kernelPackages = pkgs.linuxPackages;
/*
nixpkgs.config.allowBroken = true;
@ -128,13 +105,6 @@
];
};
nix.settings.auto-optimise-store = true;
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d"; # Ajuste comme tu veux, tu peux utiliser +5 pour garder les 5 dernières, etc.
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave

View file

@ -58,8 +58,6 @@
users = {
traxys = {
uid = 1000;
isNormalUser = true;
home = "/home/traxys";
extraGroups = [
"wheel"
"networkmanager"
@ -72,7 +70,6 @@
"scanner"
"lp"
];
shell = pkgs.zsh;
};
};
};

View file

@ -17,13 +17,6 @@ in {
};
};
nix = {
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
# boot.extraModulePackages = [ ashmem binder ];
# boot.kernelModules = [ "ashmem_linux" "binder_linux" ];