├── .gitignore
├── flake.nix
├── modules
├── hardware.nix
├── default.nix
├── graphical.nix
├── version.nix
└── gnome.nix
├── flake.lock
├── LICENSE
├── NIXPKGSLICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | .envrc
2 | /.direnv
3 | /.vscode
4 | /result
5 |
--------------------------------------------------------------------------------
/flake.nix:
--------------------------------------------------------------------------------
1 | {
2 | description = "SnowflakeOS modules";
3 |
4 | inputs = {
5 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6 | };
7 |
8 | outputs = { self, nixpkgs }:
9 | {
10 | nixosModules.snowflake = import ./modules/default.nix;
11 | nixosModules.default = self.nixosModules.snowflake;
12 | };
13 | }
14 |
--------------------------------------------------------------------------------
/modules/hardware.nix:
--------------------------------------------------------------------------------
1 | { lib, config, options, pkgs, ... }:
2 | let
3 | nvidia-offload = pkgs.writeShellScriptBin "nvidia-offload" ''
4 | export __NV_PRIME_RENDER_OFFLOAD=1
5 | export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0
6 | export __GLX_VENDOR_LIBRARY_NAME=nvidia
7 | export __VK_LAYER_NV_optimus=NVIDIA_only
8 | exec "$@"
9 | '';
10 | in
11 | {
12 | config = lib.mkIf (config.hardware.nvidia.prime.offload.enable && config.snowflakeos.graphical.enable)
13 | {
14 | environment.systemPackages = [ nvidia-offload ];
15 | };
16 | }
17 |
--------------------------------------------------------------------------------
/flake.lock:
--------------------------------------------------------------------------------
1 | {
2 | "nodes": {
3 | "nixpkgs": {
4 | "locked": {
5 | "lastModified": 1674120619,
6 | "narHash": "sha256-xLT1FQl7/jNPOEq5q/vmc3AExt1V9LtcjM+QY2+MUpA=",
7 | "owner": "nixos",
8 | "repo": "nixpkgs",
9 | "rev": "d7705c01ef0a39c8ef532d1033bace8845a07d35",
10 | "type": "github"
11 | },
12 | "original": {
13 | "owner": "nixos",
14 | "ref": "nixos-unstable",
15 | "repo": "nixpkgs",
16 | "type": "github"
17 | }
18 | },
19 | "root": {
20 | "inputs": {
21 | "nixpkgs": "nixpkgs"
22 | }
23 | }
24 | },
25 | "root": "root",
26 | "version": 7
27 | }
28 |
--------------------------------------------------------------------------------
/modules/default.nix:
--------------------------------------------------------------------------------
1 | { lib, config, options, pkgs, ... }:
2 | {
3 | imports = [
4 | ./gnome.nix
5 | ./graphical.nix
6 | ./hardware.nix
7 | ./version.nix
8 | ];
9 | nix.settings.substituters = [ "https://snowflakeos.cachix.org/" ];
10 | nix.settings.trusted-public-keys = [
11 | "snowflakeos.cachix.org-1:gXb32BL86r9bw1kBiw9AJuIkqN49xBvPd1ZW8YlqO70="
12 | ];
13 |
14 | # Reasonable Defaults
15 | nix.settings = {
16 | connect-timeout = 5;
17 | log-lines = 25;
18 | min-free = 128000000;
19 | max-free = 1000000000;
20 | experimental-features = [ "nix-command" "flakes"];
21 | fallback = true;
22 | warn-dirty = false;
23 | auto-optimise-store = true;
24 | };
25 | }
26 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2022 Victor Fuentes
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/NIXPKGSLICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2003-2022 Eelco Dolstra and the Nixpkgs/NixOS contributors
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | SnowflakeOS Modules
4 | ===
5 | [![Built with Nix][builtwithnix badge]][builtwithnix]
6 | [![License: MIT][MIT badge]][MIT]
7 | [![Chat on Matrix][matrix badge]][matrix]
8 | [![Chat on Discord][discord badge]][discord]
9 |
10 | SnowflakeOS is a NixOS based Linux distribution focused on beginner friendliness and ease of use. The modules contained in this repository set up some opinionated default used by SnowflakeOS, including some branding.
11 |
12 |
13 |
14 | [builtwithnix badge]: https://img.shields.io/badge/Built%20With-Nix-41439A?style=for-the-badge&logo=nixos&logoColor=white
15 | [builtwithnix]: https://builtwithnix.org/
16 | [MIT badge]: https://img.shields.io/badge/License-MIT-blue.svg?style=for-the-badge
17 | [MIT]: https://opensource.org/licenses/MIT
18 | [matrix badge]: https://img.shields.io/badge/matrix-join%20chat-0cbc8c?style=for-the-badge&logo=matrix&logoColor=white
19 | [matrix]: https://matrix.to/#/#snowflakeos:matrix.org
20 | [discord badge]: https://img.shields.io/discord/1021080090676842506?color=7289da&label=Discord&logo=discord&logoColor=ffffff&style=for-the-badge
21 | [discord]: https://discord.gg/6rWNMmdkgT
22 |
--------------------------------------------------------------------------------
/modules/graphical.nix:
--------------------------------------------------------------------------------
1 | { lib, config, options, pkgs, ... }:
2 | {
3 | options.snowflakeos.graphical = {
4 | enable = lib.mkEnableOption "SnowflakeOS default graphical configurations (not including DE)";
5 | };
6 |
7 | config = lib.mkIf config.snowflakeos.graphical.enable {
8 | # Enable fwupd
9 | services.fwupd.enable = lib.mkDefault true;
10 |
11 | # Add opengl/vulkan support
12 | hardware.opengl = {
13 | enable = lib.mkDefault true;
14 | driSupport = lib.mkDefault config.hardware.opengl.enable;
15 | driSupport32Bit = lib.mkDefault (config.hardware.opengl.enable && pkgs.stdenv.hostPlatform.isx86);
16 | };
17 |
18 | # Enable NetworkManager
19 | networking.networkmanager.enable = lib.mkDefault true;
20 |
21 | # Enable sound with pipewire.
22 | sound.enable = lib.mkDefault true;
23 | hardware.pulseaudio.enable = lib.mkDefault false;
24 | security.rtkit.enable = lib.mkDefault true;
25 | services.pipewire = {
26 | enable = lib.mkDefault true;
27 | alsa.enable = lib.mkDefault config.services.pipewire.enable;
28 | alsa.support32Bit = lib.mkDefault config.services.pipewire.enable;
29 | pulse.enable = lib.mkDefault config.services.pipewire.enable;
30 | };
31 |
32 | # Enable CUPS to print documents.
33 | services.printing.enable = lib.mkDefault true;
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/modules/version.nix:
--------------------------------------------------------------------------------
1 | { lib, config, options, pkgs, ... }:
2 | let
3 | cfg = config.system.nixos;
4 | needsEscaping = s: null != builtins.match "[a-zA-Z0-9]+" s;
5 | escapeIfNeccessary = s: if needsEscaping s then s else ''"${lib.escape [ "\$" "\"" "\\" "\`" ] s}"'';
6 | attrsToText = attrs:
7 | lib.concatStringsSep "\n" (
8 | lib.mapAttrsToList (n: v: ''${n}=${escapeIfNeccessary (toString v)}'') attrs
9 | ) + "\n";
10 | osReleaseContents = {
11 | NAME = "SnowflakeOS";
12 | ID = "snowflakeos";
13 | VERSION = "${cfg.release} (${cfg.codeName})";
14 | VERSION_CODENAME = lib.toLower cfg.codeName;
15 | VERSION_ID = cfg.release;
16 | BUILD_ID = cfg.version;
17 | PRETTY_NAME = "SnowflakeOS ${cfg.release} (${cfg.codeName})";
18 | LOGO = "nix-snowflake-white";
19 | HOME_URL = "https://snowflakeos.org";
20 | DOCUMENTATION_URL = "";
21 | SUPPORT_URL = "";
22 | BUG_REPORT_URL = "";
23 | };
24 | initrdReleaseContents = osReleaseContents // {
25 | PRETTY_NAME = "${osReleaseContents.PRETTY_NAME} (Initrd)";
26 | };
27 | initrdRelease = pkgs.writeText "initrd-release" (attrsToText initrdReleaseContents);
28 | in
29 | {
30 | options.snowflakeos.osInfo = {
31 | enable = lib.mkEnableOption "SnowflakeOS Main System";
32 | };
33 |
34 | config = lib.mkIf config.snowflakeos.osInfo.enable {
35 | environment.etc."os-release".text = lib.mkForce (attrsToText osReleaseContents);
36 | environment.etc."lsb-release".text = lib.mkForce (attrsToText {
37 | LSB_VERSION = "${cfg.release} (${cfg.codeName})";
38 | DISTRIB_ID = "snowflakeos";
39 | DISTRIB_RELEASE = cfg.release;
40 | DISTRIB_CODENAME = lib.toLower cfg.codeName;
41 | DISTRIB_DESCRIPTION = "SnowflakeOS ${cfg.release} (${cfg.codeName})";
42 | });
43 | boot.initrd.systemd.contents."/etc/os-release".source = lib.mkForce initrdRelease;
44 | boot.initrd.systemd.contents."/etc/initrd-release".source = lib.mkForce initrdRelease;
45 | boot.plymouth.enable = lib.mkDefault true;
46 | system.nixos.distroName = "SnowflakeOS";
47 | system.nixos.distroId = "snowflakeos";
48 | };
49 | }
50 |
--------------------------------------------------------------------------------
/modules/gnome.nix:
--------------------------------------------------------------------------------
1 | { lib, config, options, pkgs, ... }:
2 | let
3 | nixos-background-info = pkgs.stdenv.mkDerivation { name = "nixos-background-info"; };
4 | snowflakeos-background-info = pkgs.writeTextFile rec {
5 | name = "snowflakeos-background-info";
6 | text = ''
7 |
8 |
9 |
10 |
11 | Blobs
12 | ${pkgs.nixos-artwork.wallpapers.nineish.gnomeFilePath}
13 | ${pkgs.nixos-artwork.wallpapers.nineish-dark-gray.gnomeFilePath}
14 | zoom
15 | solid
16 | #3a4ba0
17 | #2f302f
18 |
19 |
20 | '';
21 | destination = "/share/gnome-background-properties/snowflakeos.xml";
22 | };
23 | in
24 | {
25 | options.snowflakeos.gnome = {
26 | enable = lib.mkEnableOption "SnowflakeOS GNOME configuration";
27 | };
28 |
29 | config = lib.mkIf config.snowflakeos.gnome.enable {
30 | snowflakeos.graphical.enable = true;
31 | services.xserver.displayManager.gdm.enable = lib.mkDefault true;
32 | services.xserver.desktopManager.gnome = {
33 | enable = lib.mkDefault true;
34 | favoriteAppsOverride = lib.mkDefault ''
35 | [org.gnome.shell]
36 | favorite-apps=[ 'firefox.desktop', 'org.gnome.Geary.desktop', 'org.gnome.Calendar.desktop', 'org.gnome.Nautilus.desktop', 'dev.vlinkz.NixSoftwareCenter.desktop' ]
37 | '';
38 | extraGSettingsOverrides = ''
39 | [org.gnome.desktop.background]
40 | picture-uri='file://${pkgs.nixos-artwork.wallpapers.nineish.gnomeFilePath}'
41 | picture-uri-dark='file://${pkgs.nixos-artwork.wallpapers.nineish-dark-gray.gnomeFilePath}'
42 | [org.gnome.desktop.screensaver]
43 | picture-uri='file://${pkgs.nixos-artwork.wallpapers.nineish-dark-gray.gnomeFilePath}'
44 | '';
45 | };
46 | environment.gnome.excludePackages = [ nixos-background-info ];
47 | environment.systemPackages = [ snowflakeos-background-info ];
48 | };
49 | }
50 |
--------------------------------------------------------------------------------