From ae8587c3a3bd555688cfa90776c24ae43bf8004a Mon Sep 17 00:00:00 2001 From: CORAAL Date: Mon, 23 Dec 2024 12:41:29 +0100 Subject: [PATCH] add flake for user, edit glf flake for expose module. --- Makefile | 2 +- {nix-cfg/glf => assets/wallpaper}/dark.jpg | Bin {nix-cfg/glf => assets/wallpaper}/white.jpg | Bin flake.lock | 24 ++- flake.nix | 65 ++++--- {nix-cfg => iso-cfg}/configuration.nix | 15 +- iso-cfg/flake.lock | 63 +++++++ iso-cfg/flake.nix | 26 +++ .../hardware-configuration.nix | 0 modules/default/boot.nix | 22 +++ {nix-cfg/glf => modules/default}/default.nix | 18 +- modules/default/firefox.nix | 25 +++ modules/default/fstrim.nix | 20 ++ modules/default/gaming.nix | 47 +++++ modules/default/gnome.nix | 178 ++++++++++++++++++ modules/default/nh.nix | 26 +++ {nix-cfg/glf => modules/default}/nvidia.nix | 11 +- modules/default/packages.nix | 46 +++++ modules/default/pipewire.nix | 38 ++++ modules/default/printing.nix | 48 +++++ modules/default/system.nix | 30 +++ modules/default/updateConf.nix | 67 +++++++ {nix-cfg/glf => modules/default}/version.nix | 36 ++-- nix-cfg/glf/boot.nix | 14 -- nix-cfg/glf/firefox.nix | 15 -- nix-cfg/glf/fstrim.nix | 6 - nix-cfg/glf/gaming.nix | 35 ---- nix-cfg/glf/gnome.nix | 154 --------------- nix-cfg/glf/imprimante.nix | 42 ----- nix-cfg/glf/nh.nix | 15 -- nix-cfg/glf/paquets.nix | 31 --- nix-cfg/glf/pipewire.nix | 24 --- nix-cfg/glf/system.nix | 25 --- nix-cfg/glf/updateConf.nix | 56 ------ .../modules/nixos/main.py | 17 +- 35 files changed, 748 insertions(+), 493 deletions(-) rename {nix-cfg/glf => assets/wallpaper}/dark.jpg (100%) rename {nix-cfg/glf => assets/wallpaper}/white.jpg (100%) rename {nix-cfg => iso-cfg}/configuration.nix (61%) create mode 100644 iso-cfg/flake.lock create mode 100644 iso-cfg/flake.nix rename {nix-cfg => iso-cfg}/hardware-configuration.nix (100%) create mode 100644 modules/default/boot.nix rename {nix-cfg/glf => modules/default}/default.nix (74%) create mode 100644 modules/default/firefox.nix create mode 100644 modules/default/fstrim.nix create mode 100644 modules/default/gaming.nix create mode 100644 modules/default/gnome.nix create mode 100644 modules/default/nh.nix rename {nix-cfg/glf => modules/default}/nvidia.nix (81%) create mode 100644 modules/default/packages.nix create mode 100644 modules/default/pipewire.nix create mode 100644 modules/default/printing.nix create mode 100644 modules/default/system.nix create mode 100644 modules/default/updateConf.nix rename {nix-cfg/glf => modules/default}/version.nix (55%) delete mode 100644 nix-cfg/glf/boot.nix delete mode 100644 nix-cfg/glf/firefox.nix delete mode 100644 nix-cfg/glf/fstrim.nix delete mode 100644 nix-cfg/glf/gaming.nix delete mode 100644 nix-cfg/glf/gnome.nix delete mode 100644 nix-cfg/glf/imprimante.nix delete mode 100644 nix-cfg/glf/nh.nix delete mode 100644 nix-cfg/glf/paquets.nix delete mode 100644 nix-cfg/glf/pipewire.nix delete mode 100644 nix-cfg/glf/system.nix delete mode 100644 nix-cfg/glf/updateConf.nix diff --git a/Makefile b/Makefile index c4b65a9..b293159 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ iso: nix --extra-experimental-features "nix-command flakes" build -L .#iso build-vm: - nixos-rebuild build-vm -I nixos-config=./nix-cfg/configuration.nix && ./result/bin/run-glfos-vm + nixos-rebuild build-vm -I nixos-config=./iso-cfg/configuration.nix && ./result/bin/run-glfos-vm # Update flake.lock update: diff --git a/nix-cfg/glf/dark.jpg b/assets/wallpaper/dark.jpg similarity index 100% rename from nix-cfg/glf/dark.jpg rename to assets/wallpaper/dark.jpg diff --git a/nix-cfg/glf/white.jpg b/assets/wallpaper/white.jpg similarity index 100% rename from nix-cfg/glf/white.jpg rename to assets/wallpaper/white.jpg diff --git a/flake.lock b/flake.lock index f10fcbe..6e0681c 100644 --- a/flake.lock +++ b/flake.lock @@ -10,14 +10,32 @@ "type": "github" }, "original": { - "id": "nixpkgs", + "owner": "NixOS", "ref": "nixos-24.11", - "type": "indirect" + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-unstable": { + "locked": { + "lastModified": 1735922141, + "narHash": "sha256-vk0xwGZSlvZ/596yxOtsk4gxsIx2VemzdjiU8zhjgWw=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "d29ab98cd4a70a387b8ceea3e930b3340d41ac5a", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" } }, "root": { "inputs": { - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs", + "nixpkgs-unstable": "nixpkgs-unstable" } } }, diff --git a/flake.nix b/flake.nix index 84f9db5..5208da3 100644 --- a/flake.nix +++ b/flake.nix @@ -1,22 +1,38 @@ { - inputs = { nixpkgs.url = "nixpkgs/nixos-24.11"; }; + description = "GLF-OS"; - outputs = { nixpkgs, ... } @ inputs: - let system = "x86_64-linux"; + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11"; + }; + + outputs = { self, nixpkgs, ... }@inputs: + let + system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; config.allowUnfree = true; }; in - rec - { + rec { + + nixosModules = { + default = import ./modules/default; + }; + iso = nixosConfigurations."glf-installer".config.system.build.isoImage; nixosConfigurations = { - "glf-installer" = nixpkgs.lib.nixosSystem { - specialArgs = { inherit inputs; }; inherit system; + "glf-installer" = nixpkgs.lib.nixosSystem rec { + specialArgs = { + inherit inputs; + pkgs = pkgs; + }; + inherit system; modules = [ "${nixpkgs}/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-gnome.nix" "${nixpkgs}/nixos/modules/installer/cd-dvd/channel.nix" - ./nix-cfg/configuration.nix + self.nixosModules.default + ./iso-cfg/configuration.nix { + nixpkgs.config.allowUnfree = true; nixpkgs.overlays = [ (self: super: { calamares-nixos-extensions = super.calamares-nixos-extensions.overrideAttrs (oldAttrs: { @@ -24,7 +40,6 @@ cp ${./patches/calamares-nixos-extensions/modules/nixos/main.py} $out/lib/calamares/modules/nixos/main.py cp -r ${./patches/calamares-nixos-extensions/config/settings.conf} $out/share/calamares/settings.conf cp -r ${./patches/calamares-nixos-extensions/config/modules/packagechooser.conf} $out/share/calamares/modules/packagechooser.conf - cp -r ${./patches/calamares-nixos-extensions/branding/nixos/show.qml} $out/share/calamares/branding/nixos/show.qml cp -r ${./patches/calamares-nixos-extensions/branding/nixos/white.png} $out/share/calamares/branding/nixos/white.png cp -r ${./patches/calamares-nixos-extensions/branding/nixos/base.png} $out/share/calamares/branding/nixos/base.png @@ -37,21 +52,23 @@ }) ]; } - ({ config, ... }: { - isoImage = { - # change default partition name (cannot exceed 32 bytes) - # volumeID = nixpkgs.lib.mkDefault "glfos${nixpkgs.lib.optionalString (config.isoImage.edition != "") "-${config.isoImage.edition}"}-${config.system.nixos.release}"; - volumeID = nixpkgs.lib.mkDefault "glfos-${config.system.nixos.version}"; - - includeSystemBuildDependencies = false; - storeContents = [ config.system.build.toplevel ]; - squashfsCompression = "zstd -Xcompression-level 22"; - contents = [{ - source = ./nix-cfg; - target = "/nix-cfg"; - }]; - }; - }) + ( + { config, ... }: + { + isoImage = { + volumeID = nixpkgs.lib.mkDefault "glfos-${config.system.nixos.version}"; + includeSystemBuildDependencies = false; + storeContents = [ config.system.build.toplevel ]; + squashfsCompression = "zstd -Xcompression-level 22"; + contents = [ + { + source = ./iso-cfg; + target = "/iso-cfg"; + } + ]; + }; + } + ) ]; }; }; diff --git a/nix-cfg/configuration.nix b/iso-cfg/configuration.nix similarity index 61% rename from nix-cfg/configuration.nix rename to iso-cfg/configuration.nix index 3c92f9f..7b35452 100755 --- a/nix-cfg/configuration.nix +++ b/iso-cfg/configuration.nix @@ -1,12 +1,6 @@ -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -# NE TOUCHEZ A RIEN -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! { config, pkgs, lib, ... }: + { - imports = [ - ./hardware-configuration.nix - ./glf - ]; i18n.defaultLocale = "fr_FR.UTF-8"; @@ -18,13 +12,14 @@ excludePackages = [ pkgs.xterm ]; }; - users.users.test = { + users.users.nixos = { isNormalUser = true; - description = "test"; extraGroups = [ "networkmanager" "wheel" "render" ]; }; - nvidia_config.enable = true; + networking.hostName = "GLF-OS"; + + # nvidia_config.enable = true; nix.settings.experimental-features = [ "nix-command" "flakes" ]; diff --git a/iso-cfg/flake.lock b/iso-cfg/flake.lock new file mode 100644 index 0000000..722b4f7 --- /dev/null +++ b/iso-cfg/flake.lock @@ -0,0 +1,63 @@ +{ + "nodes": { + "glf": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1736010151, + "narHash": "sha256-31wExlAVnTuupZN9iv2CzUIVB119wu5K9Dj3YlkdD78=", + "owner": "CORAAL", + "repo": "Nixos-by-GLF", + "rev": "42276e851a851777a04a1157af9878a77f94347a", + "type": "github" + }, + "original": { + "owner": "CORAAL", + "ref": "coraal_flakeInit", + "repo": "Nixos-by-GLF", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1734737257, + "narHash": "sha256-GIMyMt1pkkoXdCq9un859bX6YQZ/iYtukb9R5luazLM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "1c6e20d41d6a9c1d737945962160e8571df55daa", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1735922141, + "narHash": "sha256-vk0xwGZSlvZ/596yxOtsk4gxsIx2VemzdjiU8zhjgWw=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "d29ab98cd4a70a387b8ceea3e930b3340d41ac5a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "glf": "glf", + "nixpkgs": "nixpkgs_2" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/iso-cfg/flake.nix b/iso-cfg/flake.nix new file mode 100644 index 0000000..d346553 --- /dev/null +++ b/iso-cfg/flake.nix @@ -0,0 +1,26 @@ +{ + + description = "GLF-OS"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + glf.url = "github:CORAAL/Nixos-by-GLF/coraal_flakeInit"; + }; + + outputs = { self, nixpkgs, glf, ... }@inputs: + let + pkgsSettings = system: import nixpkgs { + inherit system; + config.allowUnfree = true; + }; + in { + nixosConfigurations."GLF-OS" = nixpkgs.lib.nixosSystem { + pkgs = pkgsSettings "x86_64-linux"; + modules = [ + ./configuration.nix + inputs.glf.nixosModules.default + ]; + }; + }; + +} diff --git a/nix-cfg/hardware-configuration.nix b/iso-cfg/hardware-configuration.nix similarity index 100% rename from nix-cfg/hardware-configuration.nix rename to iso-cfg/hardware-configuration.nix diff --git a/modules/default/boot.nix b/modules/default/boot.nix new file mode 100644 index 0000000..1386573 --- /dev/null +++ b/modules/default/boot.nix @@ -0,0 +1,22 @@ +{ lib, config, pkgs, ... }: + +{ + + options.glf.boot.enable = lib.mkOption { + description = "Enable GLF Boot configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.boot.enable { + + boot = { + tmp.cleanOnBoot = true; + supportedFilesystems.zfs = lib.mkDefault false; + kernelPackages = lib.mkDefault pkgs.linuxPackages_zen; + kernelParams = if builtins.elem "kvm-amd" config.boot.kernelModules then [ "amd_pstate=active" ] else [ ]; + }; + + }; + +} diff --git a/nix-cfg/glf/default.nix b/modules/default/default.nix similarity index 74% rename from nix-cfg/glf/default.nix rename to modules/default/default.nix index d090735..c7df192 100644 --- a/nix-cfg/glf/default.nix +++ b/modules/default/default.nix @@ -1,17 +1,19 @@ { + imports = [ - ./version.nix - ./nh.nix ./boot.nix - ./gnome.nix ./fstrim.nix - ./gaming.nix ./firefox.nix - ./paquets.nix - ./pipewire.nix + ./nh.nix + ./gnome.nix + ./packages.nix + ./gaming.nix + ./printing.nix ./nvidia.nix + ./pipewire.nix ./system.nix - ./updateConf.nix - ./imprimante.nix + # ./updateConf.nix + ./version.nix ]; + } diff --git a/modules/default/firefox.nix b/modules/default/firefox.nix new file mode 100644 index 0000000..165444f --- /dev/null +++ b/modules/default/firefox.nix @@ -0,0 +1,25 @@ +{ inputs, lib, config, pkgs, ... }: + +{ + + options.glf.firefox.enable = lib.mkOption { + description = "Enable GLF firefox configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.firefox.enable { + + programs.firefox = { + enable = true; + wrapperConfig.pipewireSupport = true; + languagePacks = [ "fr" "en-US" ]; + preferences = { + "intl.accept_languages" = "fr-fr,en-us,en"; + "intl.locale.requested" = "fr,en-US"; + }; + }; + + }; + +} diff --git a/modules/default/fstrim.nix b/modules/default/fstrim.nix new file mode 100644 index 0000000..c60fa64 --- /dev/null +++ b/modules/default/fstrim.nix @@ -0,0 +1,20 @@ +{ lib, config, ... }: + +{ + + options.glf.fstrim.enable = lib.mkOption { + description = "Enable GLF Fstrim configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.fstrim.enable { + + services.fstrim = { + enable = true; + interval = "daily"; + }; + + }; + +} diff --git a/modules/default/gaming.nix b/modules/default/gaming.nix new file mode 100644 index 0000000..ae29597 --- /dev/null +++ b/modules/default/gaming.nix @@ -0,0 +1,47 @@ +{ lib, config, pkgs, ... }: + +{ + + options.glf.gaming.enable = lib.mkOption { + description = "Enable GLF Gaming configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.gaming.enable { + + environment.systemPackages = with pkgs; [ + heroic + lutris + mangohud + wineWowPackages.staging + winetricks + ]; + + environment.sessionVariables = { + STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d"; + MANGOHUD_CONFIG = "control=mangohud,legacy_layout=0,horizontal,battery,time,time_format=%H\\:%M,gpu_stats,gpu_power,cpu_stats,ram,vram,fps,frametime=1,frame_timing=1,hud_no_margin,table_columns=14"; + }; + + services.udev.extraRules = '' + # USB + ATTRS{name}=="Sony Interactive Entertainment Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" + ATTRS{name}=="Sony Interactive Entertainment DualSense Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" + # Bluetooth + ATTRS{name}=="Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" + ATTRS{name}=="DualSense Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" + ''; + + hardware.steam-hardware.enable = true; + + programs.steam = { + enable = true; + package = pkgs.steam.override { extraEnv = { MANGOHUD = true; OBS_VKCAPTURE = true; }; }; + remotePlay.openFirewall = true; + localNetworkGameTransfers.openFirewall = true; + extraCompatPackages = with pkgs; [ proton-ge-bin ]; + }; + + }; + +} diff --git a/modules/default/gnome.nix b/modules/default/gnome.nix new file mode 100644 index 0000000..9f19322 --- /dev/null +++ b/modules/default/gnome.nix @@ -0,0 +1,178 @@ +{ lib, config, pkgs, ... }: + +{ + + options.glf.gnome.enable = lib.mkOption { + description = "Enable GLF Gnome configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.gnome.enable { + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # Activation de GNOME + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + services = { + udev.packages = [ pkgs.gnome-settings-daemon ]; + xserver = { + displayManager.gdm.enable = lib.mkDefault true; + desktopManager.gnome = { + enable = lib.mkDefault true; + + # Activation du Fractional Scaling + extraGSettingsOverridePackages = [ pkgs.mutter ]; + extraGSettingsOverrides = '' + [org.gnome.mutter] + experimental-features=['scale-monitor-framebuffer'] + ''; + }; + }; + }; + + documentation.nixos.enable = false; + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # Packages système + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + programs.kdeconnect = { + enable = true; + package = pkgs.gnomeExtensions.gsconnect; + }; + + environment.systemPackages = with pkgs; [ + + # theme + adw-gtk3 + graphite-gtk-theme + tela-circle-icon-theme + + # gnome + gnome-tweaks + + # Extension + gnomeExtensions.caffeine + gnomeExtensions.gsconnect + gnomeExtensions.appindicator + gnomeExtensions.dash-to-dock + + ]; + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # Paquets exclus de l'installation de GNOME + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + environment.gnome.excludePackages = with pkgs; [ + tali + iagno + hitori + atomix + yelp + geary + xterm + totem + + epiphany + packagekit + + gnome-tour + gnome-software + gnome-contacts + gnome-user-docs + gnome-packagekit + gnome-font-viewer + ]; + + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # Paramètres GNOME + # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + programs.dconf = { + enable = true; + profiles.user.databases = [ + { + settings = { + "org/gnome/desktop/wm/preferences" = { + button-layout = "appmenu:minimize,maximize,close"; + theme = "adw-gtk3"; + focus-mode = "click"; + visual-bell = false; + }; + + "org/gnome/desktop/interface" = { + cursor-theme = "Adwaita"; + gtk-theme = "adw-gtk3"; + icon-theme = "Tela-circle"; + }; + + "org/gnome/desktop/background" = { + color-shading-type = "solid"; + picture-options = "zoom"; + picture-uri = "file:///${config.environment.etc."wallpapers/glf/white.jpg".source}"; + picture-uri-dark = "file:///${config.environment.etc."wallpapers/glf/dark.jpg".source}"; + }; + + "org/gnome/desktop/peripherals/touchpad" = { + click-method = "areas"; + tap-to-click = true; + two-finger-scrolling-enabled = true; + }; + + "org/gnome/desktop/peripherals/keyboard" = { + numlock-state = true; + }; + + "org/gnome/shell" = { + disable-user-extensions = false; + enabled-extensions = [ + "caffeine@patapon.info" + "gsconnect@andyholmes.github.io" + "appindicatorsupport@rgcjonas.gmail.com" + "dash-to-dock@micxgx.gmail.com" + ]; + favorite-apps = [ + "firefox.desktop" + "steam.desktop" + "net.lutris.Lutris.desktop" + "com.heroicgameslauncher.hgl.desktop" + "discord.desktop" + "thunderbird.desktop" + "org.gnome.Nautilus.desktop" + "org.dupot.easyflatpak.desktop" + "org.gnome.Calendar.desktop" + ]; + }; + + "org/gnome/shell/extensions/dash-to-dock" = { + click-action = "minimize-or-overview"; + disable-overview-on-startup = true; + dock-position = "BOTTOM"; + running-indicator-style = "DOTS"; + isolate-monitor = false; + multi-monitor = true; + show-mounts-network = true; + always-center-icons = true; + custom-theme-shrink = true; + }; + + "org/gnome/mutter" = { + check-alive-timeout = lib.gvariant.mkUint32 30000; + dynamic-workspaces = true; + edge-tiling = true; + }; + }; + } + ]; + }; + + environment.etc = { + "wallpapers/glf/white.jpg".source = pkgs.fetchurl { + url = "https://github.com/CORAAL/Nixos-by-GLF/raw/coraal_flakeInit/assets/wallpaper/white.jpg"; + sha256 = "sha256-XTy91wEVIKZc7A39ruOc1Beg/KG2YUuOXjB2B0oDdTY="; + }; + "wallpapers/glf/dark.jpg".source = pkgs.fetchurl { + url = "https://github.com/CORAAL/Nixos-by-GLF/raw/coraal_flakeInit/assets/wallpaper/dark.jpg"; + sha256 = "sha256-zkybmVAcclbg92u16yZ6QhFCvaXeGtYs3yCxfJWx390="; + }; + }; + }; + +} diff --git a/modules/default/nh.nix b/modules/default/nh.nix new file mode 100644 index 0000000..b346092 --- /dev/null +++ b/modules/default/nh.nix @@ -0,0 +1,26 @@ +{ lib, config, ... }: + +{ + + options.glf.nh.enable = lib.mkOption { + description = "Enable GLF nh configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.nh.enable { + + environment.shellAliases = { rebuild = "nh os switch /etc/nixos"; }; + + programs.nh = { + enable = true; + clean = { + enable = true; + dates = "weekly"; + extraArgs = "--keep-since 7d --keep 3"; + }; + }; + + }; + +} diff --git a/nix-cfg/glf/nvidia.nix b/modules/default/nvidia.nix similarity index 81% rename from nix-cfg/glf/nvidia.nix rename to modules/default/nvidia.nix index f07e879..d3b65ca 100644 --- a/nix-cfg/glf/nvidia.nix +++ b/modules/default/nvidia.nix @@ -1,14 +1,11 @@ -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -# DO NOT TOUCH -# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! { config, lib, ... }: with lib; let - cfg = config.nvidia_config; + cfg = config.glf.nvidia_config; in { # declare option - options.nvidia_config = { + options.glf.nvidia_config = { enable = mkOption { type = with types; bool; default = false; @@ -37,10 +34,10 @@ in config = mkIf cfg.enable { services.xserver.videoDrivers = [ "nvidia" ]; - nixpkgs.config.nvidia.acceptLicense = true; + # nixpkgs.config.nvidia.acceptLicense = true; hardware.nvidia = { - package = config.boot.kernelPackages.nvidiaPackages.latest; + package = config.boot.kernelPackages.nvidiaPackages.beta; open = false; nvidiaSettings = true; diff --git a/modules/default/packages.nix b/modules/default/packages.nix new file mode 100644 index 0000000..78df2f1 --- /dev/null +++ b/modules/default/packages.nix @@ -0,0 +1,46 @@ +{ lib, config, pkgs, ... }: + +{ + + options.glf.packages.enable = lib.mkOption { + description = "Enable GLF Gnome configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.packages.enable { + + services.flatpak.enable = true; + systemd.services.flatpak-repo = { + wantedBy = [ "multi-user.target" ]; + requires = [ "network-online.target" ]; + after = [ "network-online.target" ]; + path = [ pkgs.flatpak ]; + script = '' + flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo && flatpak install -y flathub org.dupot.easyflatpak + ''; + }; + + environment.systemPackages = with pkgs;[ + # APP + discord + celluloid + chromium + pciutils + usbutils + git + btop + htop + + # Fetch en attendant GLF-FETCH + fastfetch + + # Bureautique + libreoffice-fresh + hunspell + hunspellDicts.fr-moderne + ]; + + }; + +} diff --git a/modules/default/pipewire.nix b/modules/default/pipewire.nix new file mode 100644 index 0000000..025d5d3 --- /dev/null +++ b/modules/default/pipewire.nix @@ -0,0 +1,38 @@ +{ lib, config, ... }: + +{ + + options.glf.pipewire.enable = lib.mkOption { + description = "Enable GLF pipewire configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.pipewire.enable { + + security.rtkit.enable = true; + services.pipewire = { + enable = true; + + jack.enable = true; + pulse.enable = true; + + alsa = { + enable = true; + support32Bit = true; + }; + + wireplumber.extraConfig = { + "10-disable-camera" = { + "wireplumber.profiles" = { + main = { + "monitor.libcamera" = "disabled"; + }; + }; + }; + }; + }; + + }; + +} diff --git a/modules/default/printing.nix b/modules/default/printing.nix new file mode 100644 index 0000000..3270796 --- /dev/null +++ b/modules/default/printing.nix @@ -0,0 +1,48 @@ +{ lib, config, pkgs, ... }: + +{ + + options.glf.printing.enable = lib.mkOption { + description = "Enable GLF printing configurations."; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.printing.enable (let + allUsers = builtins.attrNames config.users.users; + normalUsers = builtins.filter (user: config.users.users.${user}.isNormalUser == true) allUsers; + in { + # Configure printer + services.printing = { + enable = true; + startWhenNeeded = true; + drivers = with pkgs; [ + gutenprint + hplip + samsung-unified-linux-driver + splix + brlaser + brgenml1lpr + cnijfilter2 + ]; + }; + + # Enable autodiscovery + services.avahi = { + enable = true; + nssmdns4 = true; + openFirewall = true; + }; + + # Scanner support + hardware.sane = { + enable = true; + extraBackends = with pkgs; [ sane-airscan epkowa ]; + }; + + # Add all users to group scanner and lp + users.groups.scanner.members = normalUsers; + users.groups.lp.members = normalUsers; + }); + +} diff --git a/modules/default/system.nix b/modules/default/system.nix new file mode 100644 index 0000000..3c81461 --- /dev/null +++ b/modules/default/system.nix @@ -0,0 +1,30 @@ +{ lib, config, pkgs, ... }: + +{ + + options.glf.system.enable = lib.mkOption { + description = "Enable GLF systems configurations"; + type = lib.types.bool; + default = true; + }; + + config = lib.mkIf config.glf.system.enable { + + hardware.graphics = { + enable = true; + enable32Bit = true; + }; + + nix = { + optimise = { + automatic = true; + dates = [ "weekly" ]; + }; + settings = { + auto-optimise-store = true; + }; + }; + + }; + +} diff --git a/modules/default/updateConf.nix b/modules/default/updateConf.nix new file mode 100644 index 0000000..052ccb9 --- /dev/null +++ b/modules/default/updateConf.nix @@ -0,0 +1,67 @@ +{ lib, config, pkgs, ... }: + +{ + options.glf.autoUpgrade.enable = lib.mkOption { + description = "Enable GLF systems configurations auto-upgrade."; + type = lib.types.bool; + default = false; + }; + + config = lib.mkIf config.glf.autoUpgrade.enable { + let + updateScript = '' + #!/bin/bash + + # Répertoire temporaire pour cloner le dépôt + TMP_DIR=$(mktemp -d) + + # URL du dépôt Git + REPO_URL="https://github.com/GLF-OS/Nixos-by-GLF.git" + + # Branche et chemin à extraire + BRANCH="main" + SUBDIR="nix-cfg/glf" + + # Répertoire cible + TARGET_DIR="/etc/nixos/glf" + + # Clone le dépôt + git clone --depth 1 --branch "$BRANCH" "$REPO_URL" "$TMP_DIR" + + # Synchronise le sous-répertoire spécifique + rsync -a --delete "$TMP_DIR/$SUBDIR/" "$TARGET_DIR/" + + # Nettoyage + rm -rf "$TMP_DIR" + + echo "Mise à jour terminée à $(date)" >> /var/log/update-glf-config.log + ''; + in { + # Ajouter le script à /usr/local/bin + environment.etc."update-glf-config.sh".text = updateScript; + + # Service pour exécuter le script + systemd.services.update-glf-config = { + description = "Update GLF module from git"; + serviceConfig = { + ExecStart = "${pkgs.bash}/bin/bash /etc/update-glf-config.sh"; + }; + wantedBy = [ "multi-user.target" ]; + }; + + # Timer pour planifier les mises à jour + systemd.timers.update-glf-config = { + description = "Schedule GLF module updates"; + timerConfig = { + OnBootSec = "10min"; + OnUnitActiveSec = "3d"; + Persistent = true; + }; + wantedBy = [ "timers.target" ]; + }; + + # Paquets nécessaires pour le script + environment.systemPackages = with pkgs; [ git rsync ]; + }; + }; +} diff --git a/nix-cfg/glf/version.nix b/modules/default/version.nix similarity index 55% rename from nix-cfg/glf/version.nix rename to modules/default/version.nix index 2d1406d..01597b7 100644 --- a/nix-cfg/glf/version.nix +++ b/modules/default/version.nix @@ -1,7 +1,5 @@ { lib, config, options, pkgs, ... }: -# source: https://github.com/snowfallorg/snowflakeos-modules/blob/main/modules/nixos/snowflakeos/version.nix - with lib; let DISTRO_NAME = "GLF-OS"; @@ -35,17 +33,25 @@ let initrdRelease = pkgs.writeText "initrd-release" (attrsToText initrdReleaseContents); in { - environment.etc."os-release".text = mkForce (attrsToText osReleaseContents); - environment.etc."lsb-release".text = mkForce (attrsToText { - LSB_VERSION = "${cfg.release} (${cfg.codeName})"; - DISTRIB_ID = DISTRO_ID; - DISTRIB_RELEASE = cfg.release; - DISTRIB_CODENAME = toLower cfg.codeName; - DISTRIB_DESCRIPTION = "${DISTRO_NAME} ${cfg.release} (${cfg.codeName})"; - }); - boot.initrd.systemd.contents."/etc/os-release".source = mkForce initrdRelease; - boot.initrd.systemd.contents."/etc/initrd-release".source = mkForce initrdRelease; - # boot.plymouth.enable = mkDefault true; - system.nixos.distroName = DISTRO_NAME; - system.nixos.distroId = DISTRO_ID; + options.glf.version.enable = mkOption { + description = "Enable GLF version configurations."; + type = types.bool; + default = true; + }; + + config = mkIf config.glf.version.enable { + environment.etc."os-release".text = mkForce (attrsToText osReleaseContents); + environment.etc."lsb-release".text = mkForce (attrsToText { + LSB_VERSION = "${cfg.release} (${cfg.codeName})"; + DISTRIB_ID = DISTRO_ID; + DISTRIB_RELEASE = cfg.release; + DISTRIB_CODENAME = toLower cfg.codeName; + DISTRIB_DESCRIPTION = "${DISTRO_NAME} ${cfg.release} (${cfg.codeName})"; + }); + boot.initrd.systemd.contents."/etc/os-release".source = mkForce initrdRelease; + boot.initrd.systemd.contents."/etc/initrd-release".source = mkForce initrdRelease; + # boot.plymouth.enable = mkDefault true; + system.nixos.distroName = DISTRO_NAME; + system.nixos.distroId = DISTRO_ID; + }; } diff --git a/nix-cfg/glf/boot.nix b/nix-cfg/glf/boot.nix deleted file mode 100644 index 66b9467..0000000 --- a/nix-cfg/glf/boot.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ pkgs, config, lib, ... }: -{ - boot = { - tmp.cleanOnBoot = true; - supportedFilesystems.zfs = lib.mkForce false; - - # kernelPackages = pkgs.linuxPackages; - # kernelPackages = pkgs.linuxPackages_latest; - kernelPackages = pkgs.linuxPackages_zen; - # kernelPackages = pkgs.linuxPackages_xanmod_latest; - - kernelParams = if builtins.elem "kvm-amd" config.boot.kernelModules then [ "amd_pstate=active" ] else [ ]; - }; -} diff --git a/nix-cfg/glf/firefox.nix b/nix-cfg/glf/firefox.nix deleted file mode 100644 index b13fbc5..0000000 --- a/nix-cfg/glf/firefox.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ - programs = { - firefox = { - enable = true; - wrapperConfig = { - pipewireSupport = true; - }; - languagePacks = [ "fr" "en-US" ]; - preferences = { - "intl.accept_languages" = "fr-fr,en-us,en"; - "intl.locale.requested" = "fr,en-US"; - }; - }; - }; -} diff --git a/nix-cfg/glf/fstrim.nix b/nix-cfg/glf/fstrim.nix deleted file mode 100644 index a93803e..0000000 --- a/nix-cfg/glf/fstrim.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - services.fstrim = { - enable = true; - interval = "daily"; - }; -} diff --git a/nix-cfg/glf/gaming.nix b/nix-cfg/glf/gaming.nix deleted file mode 100644 index 793e3ae..0000000 --- a/nix-cfg/glf/gaming.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ pkgs, ... }: -{ - environment.systemPackages = with pkgs; [ - heroic - lutris - mangohud - ]; - - environment.sessionVariables = { - STEAM_EXTRA_COMPAT_TOOLS_PATHS = "\${HOME}/.steam/root/compatibilitytools.d"; - MANGOHUD_CONFIG = "control=mangohud,legacy_layout=0,horizontal,battery,time,time_format=%H\\:%M,gpu_stats,gpu_power,cpu_stats,ram,vram,fps,frametime=1,frame_timing=1,hud_no_margin,table_columns=14"; - }; - - services.udev.extraRules = '' - # USB - ATTRS{name}=="Sony Interactive Entertainment Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" - ATTRS{name}=="Sony Interactive Entertainment DualSense Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" - # Bluetooth - ATTRS{name}=="Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" - ATTRS{name}=="DualSense Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1" - ''; - - hardware.steam-hardware.enable = true; - - programs = { - steam = { - enable = true; - package = pkgs.steam.override { extraEnv = { MANGOHUD = true; OBS_VKCAPTURE = true; }; }; - extest.enable = true; - remotePlay.openFirewall = true; - localNetworkGameTransfers.openFirewall = true; - extraCompatPackages = with pkgs; [ proton-ge-bin ]; - }; - }; -} diff --git a/nix-cfg/glf/gnome.nix b/nix-cfg/glf/gnome.nix deleted file mode 100644 index 4ca29d4..0000000 --- a/nix-cfg/glf/gnome.nix +++ /dev/null @@ -1,154 +0,0 @@ -{ pkgs, lib, ... }: -{ - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # Activation de GNOME - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - services = { - udev.packages = [ pkgs.gnome-settings-daemon ]; - xserver = { - displayManager.gdm.enable = lib.mkDefault true; - desktopManager.gnome = { - enable = lib.mkDefault true; - - # Activation du Fractional Scaling - extraGSettingsOverridePackages = [ pkgs.mutter ]; - extraGSettingsOverrides = '' - [org.gnome.mutter] - experimental-features=['scale-monitor-framebuffer'] - ''; - }; - }; - }; - - documentation.nixos.enable = false; - - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # Packages système - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - programs.kdeconnect = { - enable = true; - package = pkgs.gnomeExtensions.gsconnect; - }; - - environment.systemPackages = with pkgs; [ - - # theme - adw-gtk3 - graphite-gtk-theme - tela-circle-icon-theme - - # gnome - gnome-tweaks - - # Extension - gnomeExtensions.caffeine - gnomeExtensions.gsconnect - gnomeExtensions.appindicator - gnomeExtensions.dash-to-dock - ]; - - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # Paquets exclus de l'installation de GNOME - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - environment.gnome.excludePackages = with pkgs; [ - tali - iagno - hitori - atomix - yelp - geary - xterm - totem - - epiphany - packagekit - - gnome-tour - gnome-software - gnome-contacts - gnome-user-docs - gnome-packagekit - gnome-font-viewer - ]; - - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - # Paramètres GNOME - # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - programs.dconf = { - enable = true; - profiles.user.databases = [ - { - settings = { - "org/gnome/desktop/wm/preferences" = { - button-layout = "appmenu:minimize,maximize,close"; - theme = "adw-gtk3"; - focus-mode = "click"; - visual-bell = false; - }; - - "org/gnome/desktop/interface" = { - cursor-theme = "Adwaita"; - gtk-theme = "adw-gtk3"; - icon-theme = "Tela-circle"; - }; - - "org/gnome/desktop/background" = { - color-shading-type = "solid"; - picture-options = "zoom"; - picture-uri = "file:///etc/nixos/glf/white.jpg"; - picture-uri-dark = "file:///etc/nixos/glf/dark.jpg"; - }; - - "org/gnome/desktop/peripherals/touchpad" = { - click-method = "areas"; - tap-to-click = true; - two-finger-scrolling-enabled = true; - }; - - "org/gnome/desktop/peripherals/keyboard" = { - numlock-state = true; - }; - - "org/gnome/shell" = { - disable-user-extensions = false; - enabled-extensions = [ - "caffeine@patapon.info" - "gsconnect@andyholmes.github.io" - "appindicatorsupport@rgcjonas.gmail.com" - "dash-to-dock@micxgx.gmail.com" - ]; - favorite-apps = [ - "firefox.desktop" - "steam.desktop" - "net.lutris.Lutris.desktop" - "com.heroicgameslauncher.hgl.desktop" - "discord.desktop" - "thunderbird.desktop" - "org.gnome.Nautilus.desktop" - "org.dupot.easyflatpak.desktop" - "org.gnome.Calendar.desktop" - ]; - }; - - "org/gnome/shell/extensions/dash-to-dock" = { - click-action = "minimize-or-overview"; - disable-overview-on-startup = true; - dock-position = "BOTTOM"; - running-indicator-style = "DOTS"; - isolate-monitor = false; - multi-monitor = true; - show-mounts-network = true; - always-center-icons = true; - custom-theme-shrink = true; - }; - - "org/gnome/mutter" = { - check-alive-timeout = lib.gvariant.mkUint32 30000; - dynamic-workspaces = true; - edge-tiling = true; - }; - }; - } - ]; - }; -} diff --git a/nix-cfg/glf/imprimante.nix b/nix-cfg/glf/imprimante.nix deleted file mode 100644 index 2db318b..0000000 --- a/nix-cfg/glf/imprimante.nix +++ /dev/null @@ -1,42 +0,0 @@ -{ config, pkgs, ... }: -let - all-users = builtins.attrNames config.users.users; - normal-users = builtins.filter (user: config.users.users.${user}.isNormalUser == true) all-users; -in -{ - # Configure printer - services.printing = { - enable = true; - startWhenNeeded = true; - drivers = with pkgs; [ - gutenprint - hplip - samsung-unified-linux-driver - splix - brlaser - brgenml1lpr - cnijfilter2 - ]; - }; - - # Enable autodiscovery - services.avahi = { - enable = true; - nssmdns4 = true; - openFirewall = true; - }; - - # systemd.services.cups-browsed.enable = false; - hardware.sane = { - enable = true; - extraBackends = with pkgs; [ sane-airscan epkowa ]; - }; - - # add all users to group scanner and lp - users.groups.scanner = { - members = normal-users; - }; - users.groups.lp = { - members = normal-users; - }; -} diff --git a/nix-cfg/glf/nh.nix b/nix-cfg/glf/nh.nix deleted file mode 100644 index 8c17958..0000000 --- a/nix-cfg/glf/nh.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: -{ - environment.shellAliases = { rebuild = "nh os switch -f /etc/nixos/configuration.nix"; }; - - environment.systemPackages = with pkgs; [ nh ]; - - programs.nh = { - enable = true; - clean = { - enable = true; - dates = "weekly"; - extraArgs = "--keep-since 7d --keep 3"; - }; - }; -} diff --git a/nix-cfg/glf/paquets.nix b/nix-cfg/glf/paquets.nix deleted file mode 100644 index b204da0..0000000 --- a/nix-cfg/glf/paquets.nix +++ /dev/null @@ -1,31 +0,0 @@ -{ pkgs, ... }: -{ - services.flatpak.enable = true; - systemd.services.flatpak-repo = { - wantedBy = [ "multi-user.target" ]; - requires = [ "network-online.target" ]; - after = [ "network-online.target" ]; - path = [ pkgs.flatpak ]; - script = '' - flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo && flatpak install -y flathub org.dupot.easyflatpak - ''; - }; - - environment.systemPackages = with pkgs;[ - # APP - discord - celluloid - chromium - pciutils - usbutils - git - - # Fetch en attendant GLF-FETCH - fastfetch - - # Bureautique - libreoffice-fresh - hunspell - hunspellDicts.fr-moderne - ]; -} diff --git a/nix-cfg/glf/pipewire.nix b/nix-cfg/glf/pipewire.nix deleted file mode 100644 index f0e0974..0000000 --- a/nix-cfg/glf/pipewire.nix +++ /dev/null @@ -1,24 +0,0 @@ -{ - security.rtkit.enable = true; - services.pipewire = { - enable = true; - - jack.enable = true; - pulse.enable = true; - - alsa = { - enable = true; - support32Bit = true; - }; - - wireplumber.extraConfig = { - "10-disable-camera" = { - "wireplumber.profiles" = { - main = { - "monitor.libcamera" = "disabled"; - }; - }; - }; - }; - }; -} diff --git a/nix-cfg/glf/system.nix b/nix-cfg/glf/system.nix deleted file mode 100644 index b8fe4a4..0000000 --- a/nix-cfg/glf/system.nix +++ /dev/null @@ -1,25 +0,0 @@ -{ - # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - # DO NOT TOUCH - # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - hardware.graphics = { - enable = true; - enable32Bit = true; - }; - - system.autoUpgrade = { enable = true; dates = "weekly"; }; - - nixpkgs = { config = { allowUnfree = true; }; }; - - nix = { - optimise = { - automatic = true; - dates = [ "daily" ]; - }; - - settings = { - auto-optimise-store = true; - }; - }; -} diff --git a/nix-cfg/glf/updateConf.nix b/nix-cfg/glf/updateConf.nix deleted file mode 100644 index 35d2c76..0000000 --- a/nix-cfg/glf/updateConf.nix +++ /dev/null @@ -1,56 +0,0 @@ -{ config, pkgs, ... }: - -let - updateScript = '' - #!/bin/bash - - # Répertoire temporaire pour cloner le dépôt - TMP_DIR=$(mktemp -d) - - # URL du dépôt Git - REPO_URL="https://github.com/GLF-OS/Nixos-by-GLF.git" - - # Branche et chemin à extraire - BRANCH="main" - SUBDIR="nix-cfg/glf" - - # Répertoire cible - TARGET_DIR="/etc/nixos/glf" - - # Clone le dépôt - git clone --depth 1 --branch "$BRANCH" "$REPO_URL" "$TMP_DIR" - - # Synchronise le sous-répertoire spécifique - rsync -a --delete "$TMP_DIR/$SUBDIR/" "$TARGET_DIR/" - - # Nettoyage - rm -rf "$TMP_DIR" - - echo "Mise à jour terminée à $(date)" >> /var/log/update-glf-config.log - ''; -in -{ - # Ajouter le script à /usr/local/bin - systemd.services.update-glf-config = { - description = "Update GLF module from git"; - serviceConfig = { - ExecStart = "${pkgs.bash}/bin/bash /etc/update-glf-config.sh"; - }; - wantedBy = [ "multi-user.target" ]; - }; - - # Définir un timer pour le service - systemd.timers.update-glf-config = { - description = "Planifiation glf module update"; - timerConfig = { - OnBootSec = "10min"; - OnUnitActiveSec = "3d"; - Persistent = true; - }; - wantedBy = [ "timers.target" ]; - }; - - environment.etc."update-glf-config.sh".text = updateScript; - - environment.systemPackages = with pkgs; [ git rsync ]; -} diff --git a/patches/calamares-nixos-extensions/modules/nixos/main.py b/patches/calamares-nixos-extensions/modules/nixos/main.py index 56349d4..0dc2bde 100644 --- a/patches/calamares-nixos-extensions/modules/nixos/main.py +++ b/patches/calamares-nixos-extensions/modules/nixos/main.py @@ -26,17 +26,17 @@ # ==================================================== # Configuration.nix (Modified) # ==================================================== -cfghead = """ { config, pkgs, lib, ... }: +cfghead = """ { inputs, config, pkgs, lib, ... }: { + nix.settings.experimental-features = [ "nix-command" "flakes" ]; imports = [ # Include the results of the hardware scan + GLF modules ./hardware-configuration.nix - ./glf ]; """ -cfg_nvidia = """ nvidia_config = { +cfg_nvidia = """ glf.nvidia_config = { enable = true; laptop = @@has_laptop@@; @@prime_busids@@ }; @@ -271,7 +271,6 @@ def generate_prime_entries(vga_devices): output_lines += f" {var_name} = \"{pci_address}\";\n" return output_lines - ## Execution start here def run(): """NixOS Configuration.""" @@ -612,9 +611,9 @@ def run(): # GLF IMPORT # ======================================================================================== - dynamic_config = "/tmp/nix-cfg/configuration.nix" # Generated by calamares - iso_config = "/iso/nix-cfg/configuration.nix" # From GLF (used for condition) - glf_module = "/iso/nix-cfg/glf" # GLF Module + dynamic_config = "/tmp/iso-cfg/configuration.nix" # Generated by calamares + iso_config = "/iso/iso-cfg/configuration.nix" # From GLF (used for condition) + glf_module = "/iso/iso-cfg/flake.nix" # GLF Module hw_cfg_dest = os.path.join(root_mount_point, "etc/nixos/hardware-configuration.nix") hw_modified = False @@ -633,7 +632,7 @@ def run(): hw_cfg = hf.read() if os.path.exists(dynamic_config): - src_dir = "/tmp/nix-cfg/" + src_dir = "/tmp/iso-cfg/" dest_dir = os.path.join(root_mount_point, "etc/nixos/") for file in os.listdir(src_dir): src_file = os.path.join(src_dir, file) @@ -675,6 +674,8 @@ def run(): [ "nixos-install", "--no-root-passwd", + "--flake", + f"{root_mount_point}/etc/nixos#GLF-OS", "--root", root_mount_point ]