Compare commits

...

8 Commits

Author SHA1 Message Date
caec25667a
Update flake.lock 2024-02-16 21:56:52 +01:00
fcf9992b3e
minor changes 2024-02-16 17:55:17 +01:00
34d654d434
Use wayland metadata in communication pacakgeset 2024-02-16 17:53:20 +01:00
33ee7046ef
nixfiles: add meta option
contains metadata about enabled modules (there's no "official" way to
check if wayland is enabled)
2024-02-16 17:50:43 +01:00
68cad3482e
fix a few osConfig defaults 2024-02-16 17:21:41 +01:00
1719c9f4aa
fix oops 2024-02-16 17:18:52 +01:00
80811ea5c8
home: Add a few package sets 2024-02-16 17:18:37 +01:00
97ba42af46
system: Add PC profile 2024-02-16 17:06:13 +01:00
17 changed files with 172 additions and 11 deletions

69
flake.lock generated
View File

@ -34,6 +34,24 @@
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -119,11 +137,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1707650010,
"narHash": "sha256-dOhphIA4MGrH4ElNCy/OlwmN24MsnEqFjRR6+RY7jZw=",
"lastModified": 1707978831,
"narHash": "sha256-UblFdWQ2MMZNzD9C/w8+7RjAJ2QIbebbzHUniQ/a44o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "809cca784b9f72a5ad4b991e0e7bcf8890f9c3a6",
"rev": "c68a9fc85c2cb3a313be6ff40511635544dde8da",
"type": "github"
},
"original": {
@ -135,11 +153,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1707743206,
"narHash": "sha256-AehgH64b28yKobC/DAWYZWkJBxL/vP83vkY+ag2Hhy4=",
"lastModified": 1708001613,
"narHash": "sha256-woOmAXW05XnqlLn7dKzCkRAEOSOdA/Z2ndVvKcjid94=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2d627a2a704708673e56346fcb13d25344b8eaf3",
"rev": "085589047343aad800c4d305cf7b98e8a3d51ae2",
"type": "github"
},
"original": {
@ -174,7 +192,29 @@
"nixpkgs": "nixpkgs",
"nixpkgs-unstable": "nixpkgs-unstable",
"pkg-android-tools": "pkg-android-tools",
"systems": "systems_2"
"rust-overlay": "rust-overlay",
"systems": "systems_3"
}
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1708049456,
"narHash": "sha256-8qGWZTQPPBhcF5dsl1KSWF+H7RX8C3BZGvqYWKBtLjQ=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "4ee92bf124fbc4e157cbce1bc2a35499866989fc",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
@ -206,6 +246,21 @@
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View File

@ -33,6 +33,11 @@
url = "github:hyprwm/contrib";
inputs.nixpkgs.follows = "nixpkgs";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, ... }@inputs:
@ -48,6 +53,7 @@
android-tools android-udev-rules;
})
inputs.hyprwm-contrib.overlays.default
inputs.rust-overlay.overlays.default
];
### Configuration

View File

@ -1,4 +1,4 @@
{ pkgs, lib, config, osConfig, options, ...}:
{ pkgs, lib, config, osConfig ? {}, options, ...}:
let
cfg = config.nixfiles.common.wm;
inherit (lib) mkDefault;

View File

@ -13,12 +13,24 @@ in
];
config = {};
options.nixfiles = {
standalone = lib.mkOption {
meta.standalone = lib.mkOption {
default = isStandalone;
description = "Whether or not the home-manager installation is standalone (standalone installations don't have access to osConfig).";
type = lib.types.bool;
readOnly = true;
internal = true;
};
meta.graphical = lib.mkOption {
description = "Whether to enable graphical home-manager applications";
type = lib.types.bool;
default = (osConfig ? services && osConfig.services.xserver.enable);
example = true;
};
meta.wayland = lib.mkOption {
description = "Whether to prefer wayland packages and configuration";
type = lib.types.bool;
default = (lib.hasAttrByPath [ "nixfiles" "meta" "wayland" ] osConfig) && osConfig.nixfiles.meta.wayland;
example = true;
};
};
}

View File

@ -0,0 +1,19 @@
{ pkgs, lib, config, osConfig ? {}, ... }:
let
cfg = config.nixfiles.packageSets.communication;
in
{
options.nixfiles.packageSets.communication = {
enable = lib.mkEnableOption "communication package set";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; lib.optionals config.nixfiles.meta.graphical [
( if config.nixfiles.meta.wayland then element-desktop-wayland else element-desktop )
telegram-desktop
signal-desktop
thunderbird
] ++ [
irssi
];
};
}

View File

@ -1,5 +1,7 @@
{...}:
{
imports = [
./communication.nix
./dev.nix
];
}

24
home/package-sets/dev.nix Normal file
View File

@ -0,0 +1,24 @@
{ pkgs, lib, config, osConfig ? {}, ... }:
let
cfg = config.nixfiles.packageSets.dev;
in
{
options.nixfiles.packageSets.dev = {
enable = lib.mkEnableOption "development package set";
};
config = lib.mkIf cfg.enable {
home.packages = with pkgs; [
neovim
ripgrep
fd
bat
# none of these need to be in my PATH since i can use nix shells but it's
# nice to have a repl and some generic tools globally available
rust-bin.stable.latest.default
python311Packages.ptpython
python311
lua
];
};
}

View File

@ -1,4 +1,4 @@
{ lib, pkgs, config, osConfig, ... }:
{ lib, pkgs, config, osConfig ? { }, ... }:
let
cfg = config.nixfiles.profile.base;
in

View File

@ -2,5 +2,6 @@
{
imports = [
./base.nix
./pc.nix
];
}

22
home/profile/pc.nix Normal file
View File

@ -0,0 +1,22 @@
{ pkgs, config, osConfig ? {}, lib, ...}:
let
cfg = config.nixfiles.profile.pc;
default = osConfig ? nixfiles && osConfig.nixfiles.profile.pc.enable;
in
{
options.nixfiles.profile.pc.enable = lib.mkOption {
description = "Whether to enable the personal computer profile";
type = lib.types.bool;
inherit default;
example = true;
};
config = lib.mkIf cfg.enable {
nixfiles = {
profile.base.enable = true;
packageSets = {
communication.enable = true;
dev.enable = true;
};
};
};
}

View File

@ -32,6 +32,7 @@
./nvidia-optimus.nix
];
nixfiles = {
profile.pc.enable = true;
common.remoteAccess.enable = true;
hardware.opengl.enable = true;
packageSets = {

View File

@ -14,5 +14,11 @@ in
];
config = {};
options.nixfiles = {
meta.wayland = lib.mkOption {
description = "Whether to prefer wayland applications and configuration";
default = false;
example = true;
type = lib.types.bool;
};
};
}

View File

@ -17,7 +17,6 @@ in
# Enable system Nix configuration
nix.enable = lib.mkDefault true;
};
nixfiles.binfmt.enable = lib.mkDefault true;
# locale settings
i18n = {

View File

@ -2,5 +2,6 @@
{
imports = [
./base.nix
./pc.nix
];
}

11
system/profile/pc.nix Normal file
View File

@ -0,0 +1,11 @@
{ pkgs, config, lib, ... }:
let
cfg = config.nixfiles.profile.pc;
in
{
options.nixfiles.profile.pc.enable = lib.mkEnableOption "the personal computer profile";
config = lib.mkIf cfg.enable {
nixfiles.profile.base.enable = lib.mkDefault true;
nixfiles.binfmt.enable = lib.mkDefault true;
};
}

View File

@ -19,6 +19,7 @@ in
desktop.enable = true;
wm.enable = true;
};
nixfiles.meta.wayland = true;
services.xserver.displayManager.sddm.enable = true;

View File

@ -21,6 +21,7 @@ in
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.displayManager.defaultSession = "plasmawayland";
programs.kdeconnect.enable = mkDefault true;
nixfiles.meta.wayland = true;
systemd.user = {
services.restart-xdg-desktop-portal-kde = {