From 6287bf357d7717b5d35da56040416ae8dc33771d Mon Sep 17 00:00:00 2001 From: Craige McWhirter Date: Wed, 25 Sep 2024 11:36:49 +1000 Subject: [PATCH] feature(cosmic): enable cosmic desktop --- flake.lock | 159 ++++++++++++++++++++- flake.nix | 4 + hosts/sanganto/default.nix | 4 +- modules/module-list.nix | 2 + modules/profiles/cosmicDesktop/default.nix | 26 ++++ modules/roles/desktop/default.nix | 108 ++++++++++++++ outputs.nix | 7 +- profiles/xmonad.nix | 4 +- 8 files changed, 302 insertions(+), 12 deletions(-) create mode 100644 modules/profiles/cosmicDesktop/default.nix create mode 100644 modules/roles/desktop/default.nix diff --git a/flake.lock b/flake.lock index cce737a..5faaaac 100644 --- a/flake.lock +++ b/flake.lock @@ -897,6 +897,30 @@ "type": "github" } }, + "cosmicDesktop": { + "inputs": { + "flake-compat": "flake-compat_13", + "nix-update": "nix-update", + "nixpkgs": [ + "nixpkgsUnstable" + ], + "nixpkgs-stable": "nixpkgs-stable", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1727141746, + "narHash": "sha256-4QPbRdvBy1MDJ5sVztFQsAl3nG3zYcVdb7IQSLmNaXs=", + "owner": "lilyinstarlight", + "repo": "nixos-cosmic", + "rev": "738a6c45f23096b8e9cd6036e547955fa81f960d", + "type": "github" + }, + "original": { + "owner": "lilyinstarlight", + "repo": "nixos-cosmic", + "type": "github" + } + }, "crane": { "inputs": { "nixpkgs": [ @@ -998,7 +1022,7 @@ "cardano-playground": "cardano-playground", "cardano-shell": "cardano-shell_7", "cardano-wallet-unpatched": "cardano-wallet-unpatched", - "flake-compat": "flake-compat_13", + "flake-compat": "flake-compat_14", "nix-bundle-exe": "nix-bundle-exe", "nixpkgs": "nixpkgs_30", "tullia": "tullia_7" @@ -1580,6 +1604,22 @@ } }, "flake-compat_13": { + "flake": false, + "locked": { + "lastModified": 1717312683, + "narHash": "sha256-FrlieJH50AuvagamEvWMIE6D2OAnERuDboFDYAED/dE=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "38fd3954cf65ce6faf3d0d45cd26059e059f07ea", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_14": { "flake": false, "locked": { "lastModified": 1635892615, @@ -1595,7 +1635,7 @@ "type": "github" } }, - "flake-compat_14": { + "flake-compat_15": { "flake": false, "locked": { "lastModified": 1650374568, @@ -1611,7 +1651,7 @@ "type": "github" } }, - "flake-compat_15": { + "flake-compat_16": { "flake": false, "locked": { "lastModified": 1696426674, @@ -1759,6 +1799,28 @@ } }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "cosmicDesktop", + "nix-update", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719994518, + "narHash": "sha256-pQMhCCHyQGRzdfAkdJ4cIWiw+JNuWsTX7f0ZYSyz0VY=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "9227223f6d922fee3c7b190b2cc238a99527bbb7", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nix", @@ -3923,7 +3985,7 @@ }, "nix-nomad_7": { "inputs": { - "flake-compat": "flake-compat_14", + "flake-compat": "flake-compat_15", "flake-utils": [ "daedalus", "tullia", @@ -4004,6 +4066,29 @@ "type": "github" } }, + "nix-update": { + "inputs": { + "flake-parts": "flake-parts", + "nixpkgs": [ + "cosmicDesktop", + "nixpkgs" + ], + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1726651036, + "narHash": "sha256-6kR4UEBZvbQNoR3l8/It5ZTCC+mB14jzj7MNnFoQJwE=", + "owner": "Mic92", + "repo": "nix-update", + "rev": "7dd0e4467c571ebb7e53d9e3d40c49f75473efdf", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "nix-update", + "type": "github" + } + }, "nix2container": { "inputs": { "flake-utils": "flake-utils_2", @@ -4216,8 +4301,8 @@ }, "nix_4": { "inputs": { - "flake-compat": "flake-compat_15", - "flake-parts": "flake-parts", + "flake-compat": "flake-compat_16", + "flake-parts": "flake-parts_2", "git-hooks-nix": "git-hooks-nix", "libgit2": "libgit2", "nixpkgs": "nixpkgs_36", @@ -4972,6 +5057,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1726969270, + "narHash": "sha256-8fnFlXBgM/uSvBlLWjZ0Z0sOdRBesyNdH0+esxqizGc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "23cbb250f3bf4f516a2d0bf03c51a30900848075", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable": { "locked": { "lastModified": 1675758091, @@ -6017,7 +6118,7 @@ "nixpkgs": [ "nixpkgs" ], - "rust-overlay": "rust-overlay" + "rust-overlay": "rust-overlay_2" }, "locked": { "lastModified": 1718869541, @@ -6037,6 +6138,7 @@ "inputs": { "cardano-node": "cardano-node", "colmena": "colmena", + "cosmicDesktop": "cosmicDesktop", "daedalus": "daedalus", "iohkNix": "iohkNix_6", "nix": "nix_4", @@ -6047,6 +6149,27 @@ } }, "rust-overlay": { + "inputs": { + "nixpkgs": [ + "cosmicDesktop", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1727058553, + "narHash": "sha256-tY/UU3Qk5gP/J0uUM4DZ6wo4arNLGAVqLKBotILykfQ=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "edc5b0f896170f07bd39ad59d6186fcc7859bbb2", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "rust-overlay_2": { "inputs": { "flake-utils": [ "ragenix", @@ -6544,6 +6667,28 @@ "type": "github" } }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "cosmicDesktop", + "nix-update", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1719887753, + "narHash": "sha256-p0B2r98UtZzRDM5miGRafL4h7TwGRC4DII+XXHDHqek=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "bdb6355009562d8f9313d9460c0d3860f525bc6c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + }, "tullia": { "inputs": { "nix-nomad": "nix-nomad", diff --git a/flake.nix b/flake.nix index 6a23600..83272b6 100644 --- a/flake.nix +++ b/flake.nix @@ -4,6 +4,10 @@ inputs = { cardano-node.url = "github:input-output-hk/cardano-node/?ref=1.35.7"; colmena.url = github:zhaofengli/colmena/?ref=v0.4.0; + cosmicDesktop = { + url = github:lilyinstarlight/nixos-cosmic; + inputs.nixpkgs.follows = "nixpkgsUnstable"; + }; daedalus.url = github:input-output-hk/daedalus/?ref=6.0.0; iohkNix.url = github:input-output-hk/iohk-nix/?ref=df1da282f996ec46b33379407df99613a1fbafdd; nix.url = github:NixOS/nix/?ref=2.24.6; diff --git a/hosts/sanganto/default.nix b/hosts/sanganto/default.nix index 155b847..9bcf73e 100644 --- a/hosts/sanganto/default.nix +++ b/hosts/sanganto/default.nix @@ -7,7 +7,6 @@ imports = [ ../../hardware/system76_thelioMira.nix # Include results of the hardware scan. ../../profiles/cron-craige.nix # Provide Craige's cron jobs - ../../profiles/desktopCraige.nix # Craige's desktop tools and apps ../../profiles/haskell-dev.nix # Haskell dev environment ../../profiles/host_common.nix # Common host configuration options ../../profiles/iog.nix # IOHK environment @@ -16,7 +15,6 @@ ../../profiles/nix-community.nix # Nix community aarch64 tooling ../../profiles/nixpkgs-dev.nix # Nix pkgs dev tools ../../profiles/openssh.nix # Enable and configure openssh - ../../profiles/pantheon.nix # Enable and configure the pantheon desktop ../../profiles/pipewire.nix # Enable and pipewire audio system ../../profiles/xmonad.nix # Xmonad desktop environment ../../profiles/yubikey.nix # Yubikey tooling @@ -51,10 +49,12 @@ fonts.packages = with pkgs; [ anonymousPro + cascadia-code # onospaced font that includes programming ligatures dejavu_fonts # A typeface family based on the Bitstream Vera fonts fira-code # Monospace font with programming ligaturess font-awesome hack-font # A typeface designed for source code + iosevka # Versatile typeface for code, from code jetbrains-mono open-sans # Used in in my polybar configuration xkcd-font # Font based handwriting in xkcd comics diff --git a/modules/module-list.nix b/modules/module-list.nix index 704ba5e..c0c1de7 100644 --- a/modules/module-list.nix +++ b/modules/module-list.nix @@ -1,3 +1,5 @@ [ + ./profiles/cosmicDesktop ./profiles/starship + ./roles/desktop ] diff --git a/modules/profiles/cosmicDesktop/default.nix b/modules/profiles/cosmicDesktop/default.nix new file mode 100644 index 0000000..1ae93b9 --- /dev/null +++ b/modules/profiles/cosmicDesktop/default.nix @@ -0,0 +1,26 @@ +# Cosmic is a software platform for designing beautiful user experiences +{ + config, + inputs, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.profiles.cosmicDesktop; + cosmicDesktop = inputs.cosmicDesktop; +in { + options.profiles.cosmicDesktop = { + enable = mkEnableOption "to enable the Cosmic desktop."; + }; + config = mkIf (cfg.enable) { + nix.settings = { + substituters = ["https://cosmic.cachix.org/"]; + trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="]; + }; + services = { + desktopManager.cosmic.enable = true; + displayManager.cosmic-greeter.enable = true; + }; + }; +} diff --git a/modules/roles/desktop/default.nix b/modules/roles/desktop/default.nix new file mode 100644 index 0000000..787c67d --- /dev/null +++ b/modules/roles/desktop/default.nix @@ -0,0 +1,108 @@ +# Desktop role +{ + config, + lib, + pkgs, + ... +}: +with lib; let + cfg = config.roles.desktop; +in { + options.roles.desktop = { + enable = mkEnableOption "to enable the desktop role."; + }; + config = mkIf (cfg.enable) { + environment.systemPackages = with pkgs; [ + brave # Privacy-oriented browser + chromium + element-desktop # A feature-rich client for Matrix.org + firefox # A web browser built from Firefox source tree + librewolf # Firefox fork, focused on privacy, security and freedom + gnome.gnome-tweaks # A tool to customize advanced GNOME 3 options + krita # A free and open source painting application + libreoffice-fresh # Comprehensive, professional-quality productivity suite + mplayer # A movie player that supports many video formats + nextcloud-client # Nextcloud desktop client + pwgen # Password generator + rsync + shotwell # Photo organizer + signal-desktop # Private, simple, and secure messenger + usbutils # Tools for working with USB devices, such as lsusb + xorg.libxcb # X C binding + ]; + networking = { + networkmanager.enable = true; # Enables network support via NetworkManager. + firewall.enable = true; + }; + nix.settings = { + substituters = ["https://cosmic.cachix.org/"]; + trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="]; + }; + services = { + acpid.enable = true; # A daemon for delivering ACPI events to userspace programs + blueman.enable = true; # GTK-based Bluetooth Manager + devmon.enable = true; # Enable external device automounting.` + displayManager = { + defaultSession = "cosmic"; # Set GNOME as the default session + }; + libinput = { + enable = true; # Enable touchpad support. + touchpad = { + tapping = true; + tappingButtonMap = "lrm"; # Set the touchpad button mappeing + }; + }; + pipewire = { + enable = true; + alsa = { + enable = true; + support32Bit = true; + }; + pulse.enable = true; + }; + udev.packages = [ + pkgs.android-udev-rules # Android udev rules list + ]; + udisks2.enable = true; # Enable udisks2 + }; + sound.enable = true; # Enable sound. + security.rtkit.enable = true; # realtime scheduling for sound + + # Configure common hardware settings + hardware = { + pulseaudio = { + enable = false; + }; + bluetooth = { + enable = true; # Enable bluetooth + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + NoPlugin = "sap"; + }; + Policy = {AutoEnable = "true";}; + }; + }; + opengl.enable = true; + }; + + # Configure libreWolf and Chromium + nixpkgs.config = {allowUnfree = true;}; + + profiles.cosmicDesktop.enable = true; + + programs = { + chromium = { + enable = true; + homepageLocation = "https://start.duckduckgo.com/"; + }; + }; + + # Groups to add + users.groups = { + audio.members = ["craige" "fiona" "hamish" "logan" "xander"]; + libvirtd.members = ["craige" "fiona" "hamish" "logan" "xander"]; + networkmanager.members = ["craige" "fiona" "hamish" "logan" "xander"]; + }; + }; +} diff --git a/outputs.nix b/outputs.nix index 2d7e27f..cf39cb6 100644 --- a/outputs.nix +++ b/outputs.nix @@ -2,6 +2,7 @@ self, cardano-node, colmena, + cosmicDesktop, daedalus, nix, nixpkgs, @@ -36,7 +37,10 @@ in { }; }; defaults = { - imports = [./modules]; + imports = [ + ./modules + cosmicDesktop.nixosModules.default + ]; # make flake inputs accessible in NixOS _module.args.inputs = inputs; profiles.starship.enable = true; @@ -146,6 +150,7 @@ in { hosts/sanganto ragenix.nixosModules.default ]; + roles.desktop.enable = true; }; sercanto = { imports = [ diff --git a/profiles/xmonad.nix b/profiles/xmonad.nix index 9ee77e1..bb1a449 100644 --- a/profiles/xmonad.nix +++ b/profiles/xmonad.nix @@ -26,11 +26,11 @@ desktopManager = { xterm.enable = false; # Disable NixOS default desktop manager. gnome.enable = false; # Enable GNOME desktop environment - plasma5.enable = true; # Enable Plasma desktop environment + plasma5.enable = false; # Enable Plasma desktop environment }; displayManager = { gdm.enable = false; # Enable the GNOME display manager - lightdm.greeters.pantheon.enable = true; + lightdm.greeters.pantheon.enable = false; }; windowManager = { # Open configuration for the window manager.