Advertisement
Guest User

Untitled

a guest
Jun 17th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.56 KB | None | 0 0
  1. { config, lib, pkgs, ... }:
  2.  
  3. let
  4. hostName = config.networking.hostName;
  5. ifDesktop = val:
  6. if (__any (x: x == hostName) [ "jmdesk" "jmlap" ]) then val else empty val;
  7. ifHost = host: val:
  8. if hostName == host then val else empty val;
  9. empty = val:
  10. if __isList val then [] else if __isAttrs val then {} else false;
  11. dirhome = config.users.extraUsers.joelmo.home;
  12. dirdocuments = "${dirhome}/Documents";
  13. in {
  14.  
  15. imports = [
  16. <nixpkgs/nixos/modules/installer/scan/not-detected.nix>
  17. /home/joelmo/Documents/musnix
  18. ];
  19.  
  20. config = {
  21.  
  22. boot = {
  23. kernelParams = [ "elevator=noop" ];
  24. tmpOnTmpfs = true;
  25. };
  26.  
  27. environment = {
  28. etc."nixos/configuration.nix".source = "/home/joelmo/.nixpkgs/${hostName}.nix";
  29. systemPackages = with pkgs; [ fuse fuse_exfat ];
  30. };
  31.  
  32. nix = {
  33. maxJobs = 4;
  34. readOnlyStore = false;
  35. requireSignedBinaryCaches = false;
  36. # useChroot = true;
  37. # sshServe.enable = true;
  38. # sshServe.keys = [ (__readFile ${dirdocuments}/configurations/jmlap_id_rsa.pub) ];
  39. };
  40.  
  41. i18n.consoleKeyMap = "uk";
  42.  
  43. nixpkgs.config.allowUnfree = true;
  44.  
  45. hardware = {
  46. cpu.intel.updateMicrocode = true;
  47. enableAllFirmware = true;
  48. } // ifDesktop {
  49. pulseaudio.enable = true;
  50. pulseaudio.package = pkgs.pulseaudioFull;
  51. opengl.driSupport32Bit = true;
  52. opengl.extraPackages = with pkgs; [ vaapiIntel ];
  53. };
  54.  
  55. musnix.enable = ifDesktop true;
  56.  
  57. networking = {
  58. firewall.enable = false;
  59. networkmanager.enable = ifDesktop true;
  60. };
  61.  
  62. powerManagement.enable = true;
  63.  
  64. services = {
  65. avahi.enable = true;
  66. avahi.nssmdns = true;
  67. avahi.browseDomains = [];
  68. avahi.publish.addresses = true;
  69. avahi.publish.enable = true;
  70. openssh.enable = true;
  71. } // ifDesktop {
  72. acpid.enable = true;
  73. locate.enable = true;
  74. locate.includeStore = true;
  75. locate.localuser = "root";
  76. upower.enable = true;
  77. printing.enable = true;
  78. # virtualboxHost.enable = true;
  79. xserver = {
  80. displayManager.sddm.enable = true;
  81. desktopManager.kde5.enable = true;
  82. useGlamor = true;
  83. enable = true;
  84. layout = "gb,se";
  85. };
  86. };
  87.  
  88. sound.enableOSSEmulation = false;
  89.  
  90. time.timeZone = "Europe/Stockholm";
  91.  
  92. users.extraUsers.joelmo = {
  93. extraGroups = [ "wheel" ] ++ ifDesktop [ "networkmanager" "audio" ];
  94. isNormalUser = true;
  95. password = "zxc";
  96. uid = 1000;
  97. };
  98.  
  99. users.extraUsers.demo = {
  100. isNormalUser = true;
  101. extraGroups = [ "networkmanager" ];
  102. password = "demo";
  103. };
  104.  
  105. systemd.user.services.ipython =
  106. with pkgs;
  107. with python27Packages; {
  108. wantedBy = [ "default.target" ];
  109. path = [ bash openssh notebook ipython "/home/joelmo/.nix-profile" ];
  110. environment = let suffix = python27.sitePackages; in {
  111. PYTHONPATH = "/home/joelmo/.nix-profile/${suffix}"
  112. + ":/home/joelmo/.local/${suffix}";
  113. SSH_AUTH_SOCK = "/run/user/1000/ssh-agent";
  114. };
  115. serviceConfig = {
  116. ExecStart = "${pkgs.python27Packages.notebook}/bin/jupyter-notebook ${dirdocuments}";
  117. CPUSchedulingPolicy = "batch";
  118. };
  119. };
  120.  
  121. systemd.user.services.syncthing = {
  122. wantedBy = [ "default.target" ];
  123. path = [ pkgs.syncthing ];
  124. environment = {
  125. STNOUPGRADE = "yes";
  126. STNORESTART = "yes";
  127. };
  128. serviceConfig = {
  129. ExecStart = "${pkgs.syncthing}/bin/syncthing -home ${dirhome}/.config/syncthing -logflags=0 -no-browser";
  130. CPUSchedulingPolicy = "batch";
  131. IOSchedulingClass = "idle";
  132. PermissionsStartOnly = true;
  133. Restart = "on-failure";
  134. SuccessExitStatus = "2 3 4";
  135. RestartForceExitStatus="3 4";
  136. };
  137. };
  138.  
  139. systemd.user.services.news = {
  140. path = with pkgs; [ rawdog ];
  141. serviceConfig = {
  142. ExecStart = "/home/joelmo/bin/news.sh";
  143. CPUSchedulingPolicy = "batch";
  144. };
  145. };
  146.  
  147. systemd.user.services.backup = {
  148. path = with pkgs; [ duplicity megatools ];
  149. serviceConfig = {
  150. ExecStart = "/home/joelmo/bin/backup.sh";
  151. };
  152. };
  153.  
  154. systemd.user.timers = ifHost "jmdesk" {
  155. backup = {
  156. wantedBy = [ "default.target" ];
  157. timerConfig = {
  158. OnCalendar = "*-*-* 22:00:00";
  159. Persistent = "true";
  160. WakeSystem = "true";
  161. };
  162. };
  163.  
  164. news = {
  165. wantedBy = [ "default.target" ];
  166. timerConfig = {
  167. OnCalendar = "*-*-* 18:00:00";
  168. Persistent = "true";
  169. WakeSystem = "true";
  170. };
  171. };
  172. };
  173. };
  174. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement