summaryrefslogtreecommitdiffstats
path: root/nixos/modules/installer/cd-dvd/installation-cd-graphical-calamares-cosmic.nix
blob: abe79381f113ac0cb8423c269453acd8db0cc05c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
{
  config,
  lib,
  pkgs,
  ...
}:

{
  imports = [ ./installation-cd-graphical-calamares.nix ];

  isoImage.edition = lib.mkDefault "cosmic";
  isoImage.configurationName = "COSMIC (Linux LTS)";

  environment.pathsToLink = [ "/share/calamares" ];

  services = {
    desktopManager.cosmic.enable = true;
    displayManager = {
      # Greeter needs to be enabled to handle an idle logout and login
      cosmic-greeter.enable = true;

      # No need to have a lockscreen on an installer ISO, enable autologin
      autoLogin = {
        enable = true;
        user = "nixos";
      };
    };
  };

  systemd.tmpfiles.rules =
    let
      desktopDir = "/home/nixos/Desktop";
      filesInHomePerms = "0644 nixos users -";
      dirsInHomePerms = "0755 nixos users - -";
      CosmicAppList_favorites = "${pkgs.writeText "favorites" ''
        [
            "calamares",
            "firefox",
            "gparted",
            "com.system76.CosmicFiles",
            "com.system76.CosmicEdit",
            "com.system76.CosmicTerm",
            "com.system76.CosmicSettings",
        ]''}";
    in
    [
      # Need to create ${desktopDir} first or we get an ownership issue because
      # otherwise ${desktopDir} gets the ownership of `root:root`.
      "d ${desktopDir} ${dirsInHomePerms}"
      "L+ ${desktopDir}/calamares.desktop ${filesInHomePerms} ${pkgs.calamares-nixos}/share/applications/calamares.desktop"
      "L+ ${desktopDir}/firefox.desktop ${filesInHomePerms} ${pkgs.firefox}/share/applications/firefox.desktop"
      "L+ ${desktopDir}/gparted.desktop ${filesInHomePerms} ${pkgs.gparted}/share/applications/gparted.desktop"
      "L+ ${desktopDir}/nixos-manual.desktop ${filesInHomePerms} /run/current-system/sw/share/applications/nixos-manual.desktop"

      # Same as ${desktopDir}, need to create all directories in the hierarchy
      "d /home/nixos/.config ${dirsInHomePerms}"
      "d /home/nixos/.config/cosmic ${dirsInHomePerms}"
      "d /home/nixos/.config/cosmic/com.system76.CosmicAppList ${dirsInHomePerms}"
      "d /home/nixos/.config/cosmic/com.system76.CosmicAppList/v1 ${dirsInHomePerms}"
      "L+ /home/nixos/.config/cosmic/com.system76.CosmicAppList/v1/favorites ${filesInHomePerms} ${CosmicAppList_favorites}"
    ];

  specialisation = {
    cosmic_latest_kernel.configuration =
      { config, ... }:
      {
        imports = [ ./latest-kernel.nix ];
        isoImage.configurationName = lib.mkForce "COSMIC (Linux ${config.boot.kernelPackages.kernel.version})";
      };
  };
}