Sorted some stuff in configuration

This commit is contained in:
Aleksandr Lebedev 2024-12-19 01:09:26 +01:00
parent 6599e23992
commit 5e05a1e5c1
36 changed files with 210 additions and 216 deletions

42
flake.lock generated
View file

@ -314,11 +314,11 @@
]
},
"locked": {
"lastModified": 1734279981,
"narHash": "sha256-NdaCraHPp8iYMWzdXAt5Nv6sA3MUzlCiGiR586TCwo0=",
"lastModified": 1734425854,
"narHash": "sha256-nzE5UbJ41aPEKf8R2ZFYtLkqPmF7EIUbNEdHMBLg0Ig=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "aa9f40c906904ebd83da78e7f328cd8aeaeae785",
"rev": "0ddd26d0925f618c3a5d85a4fa5eb1e23a09491d",
"type": "github"
},
"original": {
@ -416,11 +416,11 @@
]
},
"locked": {
"lastModified": 1734093295,
"narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=",
"lastModified": 1734344598,
"narHash": "sha256-wNX3hsScqDdqKWOO87wETUEi7a/QlPVgpC/Lh5rFOuA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8",
"rev": "83ecd50915a09dca928971139d3a102377a8d242",
"type": "github"
},
"original": {
@ -524,11 +524,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1734456362,
"narHash": "sha256-eb+OcQaSp7pcJxNe6wi52AiqLle820aD4Ejq10wmsjo=",
"lastModified": 1734563337,
"narHash": "sha256-0nOMDLi0aldc7VUfy/aBBL+4QLizccuSRG/MsBCrLQk=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "5f1df55fcb45a72e92258113685aa9064f6ebf3e",
"rev": "23e7d8f6a7d4e25c2dc6be33af07249570e66940",
"type": "github"
},
"original": {
@ -799,11 +799,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1734119587,
"narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=",
"lastModified": 1734424634,
"narHash": "sha256-cHar1vqHOOyC7f1+tVycPoWTfKIaqkoe1Q6TnKzuti4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5",
"rev": "d3c42f187194c26d9f0309a8ecc469d6c878ce33",
"type": "github"
},
"original": {
@ -860,11 +860,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1734472356,
"narHash": "sha256-RIoG3zXarfuHfzM/z/NPjoHHxl3sqYrtEatSLA1/bIk=",
"lastModified": 1734563049,
"narHash": "sha256-P/103iUx75XPXeX21M20kzttGaZJ6+c8xp9yo3fx3Zg=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "4f1fe403b18c45614d6b81423038a34cff371244",
"rev": "79a637d1962e725218ff46f5234cb3d5617ed36b",
"type": "github"
},
"original": {
@ -955,11 +955,11 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1733965552,
"narHash": "sha256-GZ4YtqkfyTjJFVCub5yAFWsHknG1nS/zfk7MuHht4Fs=",
"lastModified": 1734546875,
"narHash": "sha256-6OvJbqQ6qPpNw3CA+W8Myo5aaLhIJY/nNFDk3zMXLfM=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "2d73fc6ac4eba4b9a83d3cb8275096fbb7ab4004",
"rev": "ed091321f4dd88afc28b5b4456e0a15bd8374b4d",
"type": "github"
},
"original": {
@ -985,11 +985,11 @@
"tinted-tmux": "tinted-tmux"
},
"locked": {
"lastModified": 1734110168,
"narHash": "sha256-Q0eeLYn45ErXlqGQyXmLLHGe1mqnUiK0Y9wZRa1SNFI=",
"lastModified": 1734531336,
"narHash": "sha256-BWwJTAiWmZudUdUbyets7e3zQfjvZYtkU51blBnUBjw=",
"owner": "danth",
"repo": "stylix",
"rev": "a9e3779949925ef22f5a215c5f49cf520dea30b1",
"rev": "a2d66f25478103ac9b4adc6d6713794f7005221e",
"type": "github"
},
"original": {

198
flake.nix
View file

@ -1,20 +1,20 @@
{
description = "NixOS config";
description = "NixOS config";
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
nixvim = {
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
nixvim = {
url = "github:nix-community/nixvim";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprland.url = "github:hyprwm/Hyprland";
stylix.url = "github:danth/stylix";
#nix-flatpak.url = "github:GermanBread/declarative-flatpak/stable-v3";
#nix-flatpak.url = "github:GermanBread/declarative-flatpak/stable-v3";
apple-silicon-support.url = "github:tpwrules/nixos-apple-silicon";
#nur.url = "github:nix-community/NUR";
#nur.url = "github:nix-community/NUR";
sops-nix.url = "github:Mic92/sops-nix";
home-manager = {
@ -22,106 +22,102 @@
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
nixos-facter-modules.url = "github:numtide/nixos-facter-modules";
impermanence.url = "github:nix-community/impermanence";
};
outputs = { self, nixpkgs, stylix, nixvim, ... }@inputs:
let
#systems = ["aarch64-linux" "x86_64-linux" ];
#forAllSystems = nixpkgs.lib.genAttrs systems;
#pkgs = import nixpkgs {
# inherit system;
# config = {
# allowUnfree = true;
# };
#};
arm = "aarch64-linux";
x86 = "x86_64-linux";
username = "kylekrein";
let
#systems = ["aarch64-linux" "x86_64-linux" ];
#forAllSystems = nixpkgs.lib.genAttrs systems;
#pkgs = import nixpkgs {
# inherit system;
# config = {
# allowUnfree = true;
# };
#};
arm = "aarch64-linux";
x86 = "x86_64-linux";
general-modules = [
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.default
stylix.nixosModules.stylix
inputs.nixos-facter-modules.nixosModules.facter
];
general-modules = [
inputs.sops-nix.nixosModules.sops
inputs.home-manager.nixosModules.default
stylix.nixosModules.stylix
inputs.nixos-facter-modules.nixosModules.facter
];
first-nixos-install = "1729112485"; #stat -c %W /
in
{
nixosConfigurations = {
"${username}-homepc" = nixpkgs.lib.nixosSystem {
specialArgs = {
hwconfig = {
hostname = "${username}-homepc";
isLaptop = false;
system = x86;
useImpermanence = true;
};
inherit username;
inherit first-nixos-install;
inherit inputs; };
system = x86;
#pkgs = import nixpkgs {
# system = x86;
# config = {
# allowBroken = true;
# allowUnfree = true;
# };
# };
modules = [
inputs.impermanence.nixosModules.impermanence
inputs.disko.nixosModules.default
(import ./nixos/modules/disko/impermanence-disko.nix { device = "/dev/nvme0n1"; } )
./nixos/modules/impermanence
#nur.nixosModules.nur
./nixos/configuration.nix
./nixos/nvidia.nix
#./nixos/homepc-hardware-conf.nix
./nixos/libvirt.nix
#nix-flatpak.nixosModules.default
] ++ general-modules;
};
"${username}-mac" = nixpkgs.lib.nixosSystem {
specialArgs = {
hwconfig = {
hostname = "${username}-mac";
isLaptop = true;
system = arm;
useImpermanence = true;
};
inherit username;
inherit first-nixos-install;
inherit inputs; };
system = arm;
#pkgs = import nixpkgs {
# system = arm;
# overlays = [
# (import ./nixos/macos/widevine.nix)
# ];
# config = {
# allowBroken = true;
# allowUnfree = true;
# };
# };
modules = [
inputs.impermanence.nixosModules.impermanence
./nixos/configuration.nix
./nixos/modules/impermanence
inputs.apple-silicon-support.nixosModules.default
./nixos/mac-hardware-conf.nix
./nixos/macos/configuration.nix
] ++ general-modules;
};
first-nixos-install = "1729112485"; #stat -c %W /
in
{
nixosConfigurations = {
"kylekrein-homepc" = nixpkgs.lib.nixosSystem {
specialArgs = {
hwconfig = {
hostname = "kylekrein-homepc";
isLaptop = false;
system = x86;
useImpermanence = true;
};
inherit first-nixos-install;
inherit inputs; };
system = x86;
#pkgs = import nixpkgs {
# system = x86;
# config = {
# allowBroken = true;
# allowUnfree = true;
# };
# };
modules = [
inputs.impermanence.nixosModules.impermanence
inputs.disko.nixosModules.default
(import ./nixos/modules/disko/impermanence-disko.nix { device = "/dev/nvme0n1"; } )
./nixos/modules/impermanence
#nur.nixosModules.nur
./nixos/configuration.nix
./nixos/hardware/nvidia.nix
#./nixos/homepc-hardware-conf.nix
#nix-flatpak.nixosModules.default
] ++ general-modules;
};
"kylekrein-mac" = nixpkgs.lib.nixosSystem {
specialArgs = {
hwconfig = {
hostname = "kylekrein-mac";
isLaptop = true;
system = arm;
useImpermanence = true;
};
inherit first-nixos-install;
inherit inputs; };
system = arm;
#pkgs = import nixpkgs {
# system = arm;
# overlays = [
# (import ./nixos/macos/widevine.nix)
# ];
# config = {
# allowBroken = true;
# allowUnfree = true;
# };
# };
modules = [
inputs.impermanence.nixosModules.impermanence
./nixos/configuration.nix
./nixos/modules/impermanence
inputs.apple-silicon-support.nixosModules.default
./nixos/hosts/kylekrein-mac/mac-hardware-conf.nix
./nixos/hardware/macos/configuration.nix
] ++ general-modules;
};
};
};
};
}

View file

@ -2,13 +2,13 @@
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, lib, pkgs, stylix, hwconfig, first-nixos-install, username, nixvim, inputs, ... }:
{ config, lib, pkgs, stylix, hwconfig, first-nixos-install, nixvim, inputs, ... }:
{
imports =
[ # Include the results of the hardware scan.
inputs.home-manager.nixosModules.default
inputs.nixvim.nixosModules.nixvim
./firefox.nix
./modules/firefox
./modules/services/autoupgrade
./modules/sops
./hosts/${hwconfig.hostname}
@ -16,9 +16,9 @@
facter.reportPath = ./hosts/${hwconfig.hostname}/facter.json;
kylekrein.services.autoUpgrade = {
enable = true;
pushUpdates = if hwconfig.hostname == "${username}-homepc" then true else false;
configDir = "/home/${username}/nixos-config";
user = username;
pushUpdates = if hwconfig.hostname == "kylekrein-homepc" then true else false;
configDir = "/etc/nixos-config";
user = "root";
};
boot = {
@ -27,7 +27,7 @@
};
loader = {
systemd-boot.enable = true;
efi.canTouchEfiVariables = if hwconfig.hostname != "${username}-mac" then true else false;
efi.canTouchEfiVariables = if hwconfig.hostname != "kylekrein-mac" then true else false;
};
# Enable "Silent Boot"
consoleLogLevel = 0;
@ -93,19 +93,7 @@
# https://discourse.nixos.org/t/how-to-disable-root-user-account-in-configuration-nix/13235/3
hashedPassword = "!"; # disable root logins, nothing hashes to !
};
${username} = {
isNormalUser = true;
description = "Aleksandr Lebedev";
extraGroups = [ "networkmanager" "wheel" ];
initialPassword = "1234";
packages = with pkgs; [];
};
};
#test = {
# isNormalUser = true;
# initialPassword = "1234";
# extraGroups = [ "networkmanager" ];
#};
};
};
qt = {
@ -265,7 +253,7 @@
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 4d --keep 3";
flake = "/home/${username}/nixos-config";
flake = "/etc/nixos-config";
};
#https://discourse.nixos.org/t/dolphin-does-not-have-mime-associations/48985/3
# This fixes the unpopulated MIME menus
@ -332,14 +320,11 @@
};
home-manager = {
extraSpecialArgs = {inherit pkgs; inherit hwconfig; inherit username; inherit first-nixos-install; inherit nixvim; inherit inputs;};
users = {
"${username}" = import ./home.nix;
};
extraSpecialArgs = {inherit pkgs; inherit hwconfig; inherit first-nixos-install; inherit nixvim; inherit inputs;};
};
stylix = {
enable = true;
image = "${./hyprland/wallpaper.jpg}";
image = "${./modules/hyprland/wallpaper.jpg}";
autoEnable = true;
opacity = {
desktop = 0.5;

View file

@ -1,2 +0,0 @@
{}:
{}

View file

@ -13,11 +13,12 @@
{
imports =
[
./hyprland/hyprland.nix
./nixvim
./fastfetch
./modules/hyprland
./modules/nixvim
./modules/fastfetch
./homes/${username}
#"${if hostname != "nixosbtw" then ./macos/homemac.nix else ./empty.nix }"
] ++ (if hwconfig.useImpermanence then [ ./modules/impermanence/home.nix ] else []);
] ++ (if hwconfig.useImpermanence then [ (import ./modules/impermanence/home.nix { inherit username; inherit inputs; } ) ] else []);
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = username;
@ -101,44 +102,7 @@
#Also available: Catppuccin-Frappe Catppuccin-Latte Catppuccin-Macchiato Catppuccin-Mocha
# See all available kitty themes at: https://github.com/kovidgoyal/kitty-themes/blob/46d9dfe230f315a6a0c62f4687f6b3da20fd05e4/themes.json
};
programs.git = {
enable = true;
userName = "Aleksandr Lebedev";
userEmail = "alex.lebedev2003@icloud.com";
extraConfig = {
credential.helper = "manager";#"${pkgs.git.override { withLibsecret = true; }}/bin/git-credential-libsecret";
credential."https://github.com".username = "KyleKrein";
credential.credentialStore = "plaintext";
};
};
#gtk = {
# enable = true;
# cursorTheme.name = "Bibata-Modern-Ice";
# cursorTheme.package = pkgs.bibata-cursors;
# theme.package = pkgs.adw-gtk3;
# theme.name = "adw-gtk3";
# iconTheme.package = gruvboxPlus;
# iconTheme.name = "GruvboxPlus";
# };
#programs.firefox = {
#enable = true;
#profiles."kylekrein".extensions = with nur.repos.rycee.firefox-addons; [
# ublock-origin
#darkreader
#videospeed
#auto-tab-discard
#privacy-badger
#sponsorblock
#];
#profiles.default = {
# id = 0;
# name = "Default";
# isDefault = true;
#};
#};
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.

View file

@ -0,0 +1,14 @@
{ username, ... }:
{
programs.git = {
enable = true;
userName = "Aleksandr Lebedev";
userEmail = "alex.lebedev2003@icloud.com";
extraConfig = {
credential.helper = "manager";#"${pkgs.git.override { withLibsecret = true; }}/bin/git-credential-libsecret";
credential."https://github.com".username = "KyleKrein";
credential.credentialStore = "plaintext";
};
};
}

View file

@ -1,4 +1,10 @@
{ pkgs, lib, hwconfig, inputs, ... }:
{
imports = [
../../modules/libvirt
../../users/kylekrein
(import ../../modules/libvirt/user.nix { username = "kylekrein"; })
];
systemd.network.wait-online.enable = lib.mkForce false;
}

View file

@ -0,0 +1,6 @@
{ pkgs, lib, hwconfig, ... }:
{
imports = [
../../users/kylekrein
];
}

View file

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Before After
Before After

View file

@ -0,0 +1,6 @@
{ ... }:
{
imports = [
./hyprland.nix
];
}

View file

@ -13,7 +13,7 @@ in
enable = true;
xwayland.enable = true;
settings = {
monitor = if hwconfig.hostname == "${username}-homepc" then [
monitor = if hwconfig.hostname == "kylekrein-homepc" then [
"DP-1,2560x1440@75,1600x0,1.6"
"DP-3,2560x1440@75,0x0,1.6"
] else [",highres,auto,1.6"]

View file

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 4.2 MiB

After

Width:  |  Height:  |  Size: 4.2 MiB

Before After
Before After

View file

@ -1,4 +1,4 @@
{ lib, username, ... }:
{ lib, ... }:
{
fileSystems."/persist".neededForBoot = true;
@ -20,7 +20,7 @@
};
systemd.tmpfiles.rules = [
"d /persist/home/ 0777 root root -" # /persist/home created, owned by root
"d /persist/home/${username} 0700 ${username} users -" # /persist/home/<user> created, owned by that user
#"d /persist/home/${username} 0700 ${username} users -" # /persist/home/<user> created, owned by that user
#"d /persist/nixos-config 0700 ${username} users -"
];

View file

@ -1,4 +1,4 @@
{ pkgs, username, ... }:
{ pkgs, ... }:
{
virtualisation = {
libvirtd = {
@ -13,8 +13,6 @@
spiceUSBRedirection.enable = true;
};
users.users.${username}.extraGroups = [ "libvirtd" ];
environment.systemPackages = with pkgs; [
spice
spice-gtk
@ -24,13 +22,4 @@
#win-spice
];
programs.virt-manager.enable = true;
home-manager.users.${username} = {
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
};
};
}

View file

@ -0,0 +1,12 @@
{ username, ... }:
{
users.users.${username}.extraGroups = [ "libvirtd" ];
home-manager.users.${username} = {
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
};
};
}

View file

@ -1,4 +1,4 @@
{ config, pkgs, inputs, username, lib, hwconfig, ... }:
{ config, pkgs, inputs, lib, hwconfig, ... }:
let
keyPath = (if hwconfig.useImpermanence then "/persist/sops/age/keys.txt" else "/var/lib/sops/age/keys.txt");
in
@ -9,14 +9,4 @@ in
sops.age.keyFile = keyPath;
# This will generate a new key if the key specified above does not exist
sops.age.generateKey = true;
sops.secrets = {
"users/kylekrein" = {
neededForUsers = true;
};
};
users.users.${username} = {
hashedPasswordFile = config.sops.secrets."users/${username}".path;
initialPassword = lib.mkForce null;
};
}

View file

@ -0,0 +1,28 @@
{ pkgs, config, lib, hwconfig, inputs, stylix, first-nixos-install, ... }:
let username = "kylekrein";
in
{
imports = [
];
users.users.${username} = {
isNormalUser = true;
description = "Aleksandr Lebedev";
extraGroups = [ "networkmanager" "wheel" ];
#initialPassword = "1234";
hashedPasswordFile = config.sops.secrets."users/${username}".path;
packages = with pkgs; [];
};
sops.secrets = {
"users/${username}" = {
neededForUsers = true;
};
};
home-manager.users."${username}" = import ../../home.nix { inherit username; inherit inputs; inherit stylix; inherit first-nixos-install; inherit hwconfig; inherit config; inherit pkgs; };
kylekrein.services.autoUpgrade = {
configDir = lib.mkForce "/home/${username}/nixos-config";
user = lib.mkForce username;
};
programs.nh.flake = lib.mkForce "/home/${username}/nixos-config";
systemd.tmpfiles.rules = (if hwconfig.useImpermanence then ["d /persist/home/${username} 0700 ${username} users -"] else []); # /persist/home/<user> created, owned by that user
}