Made productive a specialisation, fixes #15 and #21

This commit is contained in:
EsVagy42 2025-07-15 16:55:59 +02:00
parent c85b912998
commit 1c43207211
4 changed files with 213 additions and 177 deletions

View file

@ -1 +1 @@
Updated nixvim in flake Made productive a specialisation

View file

@ -2,11 +2,126 @@
# your system. Help is available in the configuration.nix(5) man page # your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help). # and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, lib, ... }: {
config,
pkgs,
lib,
...
}:
let
basePackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
kdePackages.krecorder
kdePackages.kweather
kdePackages.kcharselect
kdePackages.filelight
kdePackages.kcalc
kdePackages.kclock
kdePackages.kholidays
kdePackages.akonadi-calendar
kdePackages.libkdepim
kdePackages.kdepim-addons
kdePackages.kdepim-runtime
kdePackages.kcontacts
libqalculate
qalculate-qt
maliit-keyboard
librewolf
kdePackages.plasma-browser-integration
kdePackages.xdg-desktop-portal-kde
kdePackages.zanshin
kdePackages.korganizer
kdePackages.merkuro
kdePackages.francis
wl-clipboard
lldb
kdePackages.kompare
kdePackages.kdevelop
kdePackages.kcachegrind
gcc
gdb
clang-tools
bash-language-server
nixd
nixfmt-rfc-style
marksman
kdePackages.markdownpart
lua
lua-language-server
cppcheck
nixos-shell
kdePackages.qtwebengine
kdePackages.qtlocation
kdePackages.ksystemstats # needed for the resource widgets
aspell # needed for spell checking
aspellDicts.en
aspellDicts.hu
kdePackages.qtmultimedia
kdePackages.karousel
(
with pkgs;
import ./kwin4_effect_geometry_change/kwin4_effect_geometry_change.nix {
inherit lib;
inherit stdenv;
inherit fetchFromGitHub;
kpackage = kdePackages.kpackage;
kwin = kdePackages.kwin;
inherit nodejs;
}
)
gimp
inkscape
kdePackages.kdenlive
libreoffice
pandoc
texliveFull
beeper
];
unproductivePackages = with pkgs; [
yt-dlp
srb2
superTuxKart
kdePackages.kjumpingcube
kdePackages.kigo
gnugo
crawlTiles
prismlauncher
mindustry
(
with pkgs;
import ./jgrpp-0.65.2/jgrpp-0.65.2.nix {
inherit fetchFromGitHub;
inherit openttd;
inherit zstd;
}
)
# retroarch-full
wineWowPackages.staging
winetricks
jdk # needed for stellwerksim
chess-clock
];
in
{ {
nixpkgs.config.allowUnfree = false; nixpkgs.config.allowUnfree = false;
nix.settings.experimental-features = [ "nix-command" "flakes" ]; nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix.settings.auto-optimise-store = true; nix.settings.auto-optimise-store = true;
nix.gc = { nix.gc = {
automatic = true; automatic = true;
@ -20,8 +135,9 @@
boot.loader.grub.efiSupport = true; boot.loader.grub.efiSupport = true;
boot.loader.efi.canTouchEfiVariables = true; boot.loader.efi.canTouchEfiVariables = true;
boot.loader.grub.useOSProber = true; boot.loader.grub.useOSProber = true;
system.nixos.label = builtins.replaceStrings [ "\n" " " ] [ "" "_" ] system.nixos.label = builtins.replaceStrings [ "\n" " " ] [ "" "_" ] (
(builtins.readFile ./commit_text); builtins.readFile ./commit_text
);
# Needed for audio to work # Needed for audio to work
boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest; boot.kernelPackages = pkgs.linuxPackagesFor pkgs.linux_latest;
@ -88,20 +204,24 @@
users.users.esvagy = { users.users.esvagy = {
isNormalUser = true; isNormalUser = true;
description = "EsVagy"; description = "EsVagy";
extraGroups = [ "networkmanager" "wheel" ]; extraGroups = [
"networkmanager"
"wheel"
];
initialPassword = "initialPassword"; initialPassword = "initialPassword";
}; };
programs.kdeconnect.enable = true; programs.kdeconnect.enable = true;
programs.steam = { programs.steam = {
enable = !config.productiveBuild; enable = true;
remotePlay.openFirewall = true; remotePlay.openFirewall = true;
dedicatedServer.openFirewall = true; dedicatedServer.openFirewall = true;
localNetworkGameTransfers.openFirewall = true; localNetworkGameTransfers.openFirewall = true;
}; };
nixpkgs.config.allowUnfreePredicate = pkg: nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (pkgs.lib.getName pkg) [ builtins.elem (pkgs.lib.getName pkg) [
"beeper" "beeper"
"steam" "steam"
@ -144,117 +264,14 @@
}; };
}; };
environment.sessionVariables = { GTK_USE_PORTAL = 1; }; environment.sessionVariables = {
GTK_USE_PORTAL = 1;
};
# List packages installed in system profile. To search, run: # List packages installed in system profile. To search, run:
# $ nix search wget # $ nix search wget
environment.systemPackages = let # putting environment.systemPackages in specialisation does not work
basePackages = with pkgs; [ environment.systemPackages = if config.specialisation != {} then basePackages ++ unproductivePackages else basePackages;
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
kdePackages.krecorder
kdePackages.kweather
kdePackages.kcharselect
kdePackages.filelight
kdePackages.kcalc
kdePackages.kclock
kdePackages.kholidays
kdePackages.akonadi-calendar
kdePackages.libkdepim
kdePackages.kdepim-addons
kdePackages.kdepim-runtime
kdePackages.kcontacts
libqalculate
qalculate-qt
maliit-keyboard
librewolf
kdePackages.plasma-browser-integration
kdePackages.xdg-desktop-portal-kde
kdePackages.zanshin
kdePackages.korganizer
kdePackages.merkuro
kdePackages.francis
wl-clipboard
lldb
kdePackages.kompare
kdePackages.kdevelop
kdePackages.kcachegrind
gcc
gdb
clang-tools
bash-language-server
nixd
nixfmt-rfc-style
marksman
kdePackages.markdownpart
lua
lua-language-server
cppcheck
nixos-shell
kdePackages.qtwebengine
kdePackages.qtlocation
kdePackages.ksystemstats # needed for the resource widgets
aspell # needed for spell checking
aspellDicts.en
aspellDicts.hu
kdePackages.qtmultimedia
kdePackages.karousel
(with pkgs;
import ./kwin4_effect_geometry_change/kwin4_effect_geometry_change.nix {
inherit lib;
inherit stdenv;
inherit fetchFromGitHub;
kpackage = kdePackages.kpackage;
kwin = kdePackages.kwin;
inherit nodejs;
})
gimp
inkscape
kdePackages.kdenlive
libreoffice
pandoc
texliveFull
beeper
];
unproductivePackages = with pkgs; [
yt-dlp
srb2
superTuxKart
kdePackages.kjumpingcube
kdePackages.kigo
gnugo
crawlTiles
prismlauncher
mindustry
(with pkgs;
import ./jgrpp-0.65.2/jgrpp-0.65.2.nix {
inherit fetchFromGitHub;
inherit openttd;
inherit zstd;
})
retroarch-full
wineWowPackages.staging
winetricks
jdk # needed for stellwerksim
chess-clock
];
in if config.productiveBuild then
basePackages
else
basePackages ++ unproductivePackages;
fonts.packages = with pkgs; [ nerd-fonts.hack ]; fonts.packages = with pkgs; [ nerd-fonts.hack ];
@ -272,8 +289,14 @@
# services.openssh.enable = true; # services.openssh.enable = true;
# Open ports in the firewall. # Open ports in the firewall.
networking.firewall.allowedTCPPorts = [ 2350 3450 ]; # needed for tmnf networking.firewall.allowedTCPPorts = [
networking.firewall.allowedUDPPorts = [ 2350 3450 ]; # needed for tmnf 2350
3450
]; # needed for tmnf
networking.firewall.allowedUDPPorts = [
2350
3450
]; # needed for tmnf
# Or disable the firewall altogether. # Or disable the firewall altogether.
# networking.firewall.enable = false; # networking.firewall.enable = false;
@ -294,36 +317,51 @@
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "24.05"; # Did you read the comment? system.stateVersion = "24.05"; # Did you read the comment?
networking.nameservers = [ ];
specialisation = {
productive = {
inheritParentConfig = true;
configuration = {
programs.steam.enable = lib.mkOverride 99 false;
services.blocky = { services.blocky = {
enable = config.productiveBuild; enable = true;
settings = { settings = {
ports.dns = 53; # Port for incoming DNS Queries. ports.dns = 53; # port for incoming dns queries.
upstreams.groups.default = [ upstreams.groups.default = [
"https://one.one.one.one/dns-query" # Using Cloudflare's DNS over HTTPS server for resolving queries. "https://one.one.one.one/dns-query" # using cloudflare's dns over https server for resolving queries.
]; ];
# For initially solving DoH/DoT Requests when no system Resolver is available. # For initially solving DoH/DoT Requests when no system Resolver is available.
bootstrapDns = { bootstrapDns = {
upstream = "https://one.one.one.one/dns-query"; upstream = "https://one.one.one.one/dns-query";
ips = [ "1.1.1.1" "1.0.0.1" ]; ips = [
"1.1.1.1"
"1.0.0.1"
];
}; };
#Enable Blocking of certian domains. #Enable Blocking of certian domains.
blocking = { blocking = {
blackLists = { blackLists = {
unproductive = ['' unproductive = [
''
| |
www.youtube.com www.youtube.com
tilvids.com tilvids.com
mastodon.social mastodon.social
online-go.com online-go.com
'']; ''
];
}; };
#Configure what block categories are used #Configure what block categories are used
clientGroupsBlock = { default = [ "unproductive" ]; }; clientGroupsBlock = {
default = [ "unproductive" ];
};
};
};
};
networking.nameservers = lib.mkOverride 99 [ "127.0.0.1" ];
}; };
}; };
}; };
networking.nameservers =
if config.productiveBuild then [ "127.0.0.1" ] else [ ];
} }

View file

@ -19,7 +19,13 @@
}; };
outputs = outputs =
{ nixpkgs, home-manager, plasma-manager, nixvim, ... }@inputs: {
nixpkgs,
home-manager,
plasma-manager,
nixvim,
...
}@inputs:
let let
system = "x86_64-linux"; system = "x86_64-linux";
pkgs = import nixpkgs { pkgs = import nixpkgs {
@ -27,38 +33,29 @@
config.allowUnfree = false; config.allowUnfree = false;
}; };
lib = nixpkgs.lib; lib = nixpkgs.lib;
in { in
nixosConfigurations = let {
baseSystem = { productiveBuild }: nixosConfigurations = {
lib.nixosSystem { nixos = lib.nixosSystem {
inherit system; inherit system;
modules = [ modules = [
{ {
environment.systemPackages = environment.systemPackages = [ inputs.nixvim.packages.${system}.default ];
[ inputs.nixvim.packages.${system}.default ];
} }
({ lib, ... }: {
options.productiveBuild = lib.mkOption {
type = lib.types.bool;
default = productiveBuild;
};
})
./configuration.nix ./configuration.nix
./devices/default/default.nix ./devices/default/default.nix
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true; home-manager.useUserPackages = true;
home-manager.sharedModules = home-manager.sharedModules = [ plasma-manager.homeManagerModules.plasma-manager ];
[ plasma-manager.homeManagerModules.plasma-manager ];
home-manager.users.esvagy = { imports = [ ./home.nix ]; }; home-manager.users.esvagy = {
imports = [ ./home.nix ];
};
} }
]; ];
}; };
in {
nixos = baseSystem { productiveBuild = false; };
productive = baseSystem { productiveBuild = true; };
}; };
}; };
} }

1
result Symbolic link
View file

@ -0,0 +1 @@
/nix/store/m7j1lj59w72b5zpqvdd8w0gmg04apyaz-nixos-system-nixos-Updated_nixvim_in_flake