From b9cdbd90c5b1ca9c35160678e286c6fa537be2a0 Mon Sep 17 00:00:00 2001 From: "RingOfStorms (Joshua Bell)" Date: Sun, 15 Jun 2025 11:56:52 -0500 Subject: [PATCH] add flatpaks --- common/_home_manager/default.nix | 2 +- common/_home_manager/mods/zsh.nix | 2 +- common/flake.nix | 4 ++ common/programs/default.nix | 1 + common/programs/flatpaks.nix | 58 +++++++++++++++++++++ hosts/lio/flake.lock | 84 +++++++++++++++---------------- hosts/lio/flake.nix | 37 +++++++------- 7 files changed, 125 insertions(+), 63 deletions(-) create mode 100644 common/programs/flatpaks.nix diff --git a/common/_home_manager/default.nix b/common/_home_manager/default.nix index d93e235..5b76221 100644 --- a/common/_home_manager/default.nix +++ b/common/_home_manager/default.nix @@ -22,7 +22,7 @@ in }; stateVersion = lib.mkOption { type = lib.types.str; - default = "23.11"; + default = "25.05"; description = "Home manager state version"; }; }; diff --git a/common/_home_manager/mods/zsh.nix b/common/_home_manager/mods/zsh.nix index 1fdc3bb..41a32a9 100644 --- a/common/_home_manager/mods/zsh.nix +++ b/common/_home_manager/mods/zsh.nix @@ -8,7 +8,7 @@ defaultKeymap = "emacs"; - initExtra = '' + initContent = '' # Set editor to neovim, TODO only do this if mod.neovim is enabled export EDITOR=nvim export VISUAL=nvim diff --git a/common/flake.nix b/common/flake.nix index d6f164c..3b0b0ea 100644 --- a/common/flake.nix +++ b/common/flake.nix @@ -2,6 +2,7 @@ inputs = { home-manager.url = "github:rycee/home-manager/release-25.05"; ragenix.url = "github:yaxitech/ragenix"; + nix-flatpak.url = "github:gmodena/nix-flatpak/?ref=latest"; # hyprland.url = "github:hyprwm/Hyprland"; # cosmic.url = "github:lilyinstarlight/nixos-cosmic"; @@ -11,6 +12,7 @@ { home-manager, ragenix, + nix-flatpak, ... }: { @@ -25,6 +27,7 @@ imports = [ home-manager.nixosModules.home-manager ragenix.nixosModules.age + nix-flatpak.nixosModules.nix-flatpak ./_home_manager ./options.nix ./general @@ -37,6 +40,7 @@ config = { _module.args = { inherit ragenix; + inherit nix-flatpak; }; }; }; diff --git a/common/programs/default.nix b/common/programs/default.nix index 83e7271..ff08a58 100644 --- a/common/programs/default.nix +++ b/common/programs/default.nix @@ -13,6 +13,7 @@ in ./docker.nix ./podman.nix ./incus.nix + ./flatpaks.nix ]; config = { assertions = [ diff --git a/common/programs/flatpaks.nix b/common/programs/flatpaks.nix new file mode 100644 index 0000000..bc3beb6 --- /dev/null +++ b/common/programs/flatpaks.nix @@ -0,0 +1,58 @@ +{ + config, + lib, + ... +}: +let + ccfg = import ../config.nix; + cfg_path = [ + ccfg.custom_config_key + "programs" + "flatpaks" + ]; + cfg = lib.attrsets.getAttrFromPath cfg_path config; +in +{ + options = + { } + // lib.attrsets.setAttrByPath cfg_path { + enable = lib.mkEnableOption "flatpaks"; + packages = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = "List of Flatpak package names to install."; + }; + }; + + config = lib.mkIf cfg.enable { + services.flatpak = { + enable = true; + packages = cfg.packages; + overrides = { + global = { + Context.sockets = [ + "wayland" + "x11" + ]; + + Environment = { + XCURSOR_PATH = "/run/host/user-share/icons:/run/host/share/icons"; + GTK_THEME = "Adwaita:dark"; + # Force wayland as much as possible. + ELECTRON_OZONE_PLATFORM_HINT = "wayland"; # or 'auto' + }; + }; + "org.signal.Signal" = { + Environment = { + SIGNAL_PASSWORD_STORE = "gnome-libsecret"; + }; + Context = { + sockets = [ + "xfg-settings" + ]; + }; + }; + }; + }; + }; +} diff --git a/hosts/lio/flake.lock b/hosts/lio/flake.lock index 2d16e51..0e26889 100644 --- a/hosts/lio/flake.lock +++ b/hosts/lio/flake.lock @@ -28,22 +28,18 @@ "common": { "inputs": { "home-manager": "home-manager", - "nixpkgs": "nixpkgs_2", + "nix-flatpak": "nix-flatpak", "ragenix": "ragenix" }, "locked": { - "lastModified": 1749562551, - "narHash": "sha256-xZVEYv9N8kSxM1cR0E5vNp2cn70pfC7cDlmZS4N4BV4=", - "ref": "refs/heads/master", - "rev": "ee3fd2dcbba3268188f5d8460b4169e571eed5ae", - "revCount": 468, - "type": "git", - "url": "https://git.joshuabell.xyz/ringofstorms/dotfiles" + "path": "../../common", + "type": "path" }, "original": { - "type": "git", - "url": "https://git.joshuabell.xyz/ringofstorms/dotfiles" - } + "path": "../../common", + "type": "path" + }, + "parent": [] }, "crane": { "locked": { @@ -107,16 +103,16 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1747688870, - "narHash": "sha256-ypL9WAZfmJr5V70jEVzqGjjQzF0uCkz+AFQF7n9NmNc=", + "lastModified": 1748487945, + "narHash": "sha256-e9zc/rHdoH9i+sFFhhQiKoF6IuD+T2rB/nUyPaO7CCg=", "owner": "rycee", "repo": "home-manager", - "rev": "d5f1f641b289553927b3801580598d200a501863", + "rev": "0d13ea58d565d3c1c1468ddae1f623316dc395d9", "type": "github" }, "original": { "owner": "rycee", - "ref": "release-24.11", + "ref": "release-25.05", "repo": "home-manager", "type": "github" } @@ -144,39 +140,39 @@ "type": "github" } }, + "nix-flatpak": { + "locked": { + "lastModified": 1739444422, + "narHash": "sha256-iAVVHi7X3kWORftY+LVbRiStRnQEob2TULWyjMS6dWg=", + "owner": "gmodena", + "repo": "nix-flatpak", + "rev": "5e54c3ca05a7c7d968ae1ddeabe01d2a9bc1e177", + "type": "github" + }, + "original": { + "owner": "gmodena", + "ref": "latest", + "repo": "nix-flatpak", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1746055187, - "narHash": "sha256-3dqArYSMP9hM7Qpy5YWhnSjiqniSaT2uc5h2Po7tmg0=", + "lastModified": 1748302896, + "narHash": "sha256-ixMT0a8mM091vSswlTORZj93WQAJsRNmEvqLL+qwTFM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3e362ce63e16b9572d8c2297c04f7c19ab6725a5", + "rev": "7848cd8c982f7740edf76ddb3b43d234cb80fc4d", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.11", + "ref": "nixos-25.05", "repo": "nixpkgs", "type": "github" } }, "nixpkgs_2": { - "locked": { - "lastModified": 1748190013, - "narHash": "sha256-R5HJFflOfsP5FBtk+zE8FpL8uqE7n62jqOsADvVshhE=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "62b852f6c6742134ade1abdd2a21685fd617a291", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_3": { "locked": { "lastModified": 1741379970, "narHash": "sha256-Wh7esNh7G24qYleLvgOSY/7HlDUzWaL/n4qzlBePpiw=", @@ -192,7 +188,7 @@ "type": "github" } }, - "nixpkgs_4": { + "nixpkgs_3": { "locked": { "lastModified": 1748302896, "narHash": "sha256-ixMT0a8mM091vSswlTORZj93WQAJsRNmEvqLL+qwTFM=", @@ -208,7 +204,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_4": { "locked": { "lastModified": 1749553941, "narHash": "sha256-FBEOaw/L33Ld39Q5I7ENVlT0qqH1CSU1q/zlZKrJKs0=", @@ -1124,7 +1120,7 @@ "agenix": "agenix", "crane": "crane", "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "rust-overlay": "rust-overlay" }, "locked": { @@ -1144,13 +1140,13 @@ "root": { "inputs": { "common": "common", - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_3", "ros_neovim": "ros_neovim" } }, "ros_neovim": { "inputs": { - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_4", "nvim_plugin-Almo7aya/openingh.nvim": "nvim_plugin-Almo7aya/openingh.nvim", "nvim_plugin-CopilotC-Nvim/CopilotChat.nvim": "nvim_plugin-CopilotC-Nvim/CopilotChat.nvim", "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring": "nvim_plugin-JoosepAlviste/nvim-ts-context-commentstring", @@ -1210,11 +1206,11 @@ "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1749563667, - "narHash": "sha256-0Dylc2IzymWjqovXfK224h2xRA0Z8hJPmdlfXWI5T+Q=", + "lastModified": 1749563872, + "narHash": "sha256-ba60Ejo5WoZ9GMmqbw4QqLLn5d3VKHXMotgT0NPnvTg=", "ref": "refs/heads/master", - "rev": "19e2019f2f9868bb08d377ef921dd65fb749268f", - "revCount": 286, + "rev": "ff863bc6bbfdfdbe0b7773ba4495163f46335e97", + "revCount": 287, "type": "git", "url": "https://git.joshuabell.xyz/ringofstorms/nvim" }, diff --git a/hosts/lio/flake.nix b/hosts/lio/flake.nix index c5d862d..a2d2f73 100644 --- a/hosts/lio/flake.nix +++ b/hosts/lio/flake.nix @@ -4,8 +4,8 @@ # nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # Use relative to get current version for testing - # common.url = "path:../../common"; - common.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles"; + common.url = "path:../../common"; + # common.url = "git+https://git.joshuabell.xyz/ringofstorms/dotfiles"; ros_neovim.url = "git+https://git.joshuabell.xyz/ringofstorms/nvim"; }; @@ -44,9 +44,6 @@ steam ffmpeg-full appimage-run - rustdesk-flutter - element-desktop - obsidian ]; # Also allow this key to work for root user, this will let us use this as a remote builder easier @@ -72,6 +69,22 @@ tailnet.enableExitNode = true; ssh.enable = true; docker.enable = true; + flatpaks = { + enable = true; + packages = [ + "org.signal.Signal" + "com.discordapp.Discord" + "md.obsidian.Obsidian" + "com.spotify.Client" + "org.videolan.VLC" + "com.bitwarden.desktop" + "org.openscad.OpenSCAD" + "org.blender.Blender" + "im.riot.Riot" + "com.rustdesk.RustDesk" + "com.google.Chrome" + ]; + }; }; users = { # Users are all normal users and default password is password1 @@ -87,18 +100,8 @@ "input" ]; shell = pkgs.zsh; - packages = with pkgs; [ - signal-desktop - spotify - blender - google-chrome - discord - firefox-esr - openscad - vlc - bitwarden - vaultwarden - ]; + # packages = with pkgs; [ + # ]; }; }; };