complete-computing-environment/nixos.org

3.3 KiB

CCE Nixos Core

Nix is a Tool for building Linux systems in a declarative idempotent method and is a good fit for the CCE, I think when moving past Fedora Linux.

(provide 'cce/nixos)
(use-package nix-mode)
(use-package nixpkgs-fmt)
(use-package nix-buffer)
(use-package nix-update)
(use-package company-nixos-options
  :hook
  (nix-mode . (lambda ()
                (make-local-variable 'company-backends)
                (add-to-list 'company-backends 'company-nixos-options))))
(use-package nix-sandbox)

(defun cce-find-nix-output-at-point ()
  (interactive)
  (->>
   (nix-store-path-at-point)
   (make-instance 'nix-store-path :path )
   (nix-store-fill-data )
   (nix-store-path-outputs )
   (completing-read "Select an output" )
   (find-file)))

Installing Nix on non-NixOS machines

- name: /nix exists
  file:
    path: /nix
    state: directory
    owner: "{{local_account}}"
    group: "{{local_account}}"
  tags:
  - nixos

- name: nix installed
  shell:
    executable: /bin/bash
    cmd: "bash <(curl -L https://nixos.org/nix/install) --no-daemon"
    creates: /nix/store/
  become: yes
  become_user: "{{local_account}}"
  tags:
  - nixos

The Ansible Manages my Laptop until I deploy NixOS and adapt CCE for it.

if [ -e /home/rrix/.nix-profile/etc/profile.d/nix.sh ]; then . /home/rrix/.nix-profile/etc/profile.d/nix.sh; fi

nix and nixpkgs configuration for My NixOS configuration

{ pkgs, ... }:

{
  # less nix crap
  nix.gc = {
    automatic = true;
    dates = "23:30";
    options = "--delete-older-than 30d";
    persistent = true;
  };

  nix.distributedBuilds = true;
  nix.buildMachines = [
    { hostName = "virtuous-cassette";
      maxJobs = 6;
      sshUser = "builder";
      systems = [
        "x86_64-linux"
        "aarch64-linux"
      ];
    }
    { hostName = "window-smoke";
      maxJobs = 6;
      sshUser = "builder";
      systems = [
        "x86_64-linux"
        "aarch64-linux"
      ];
    }
  ];
  nix.settings.trusted-users = ["rrix" "root" "@wheel"];

  # hahaha! yes
  nixpkgs.config = { allowUnfree = true; };

  environment.systemPackages = with pkgs; [
    nix-tree
    nix-du
    nurl
  ];
}

DONE remove the nixpkgs.config.permittedInsecurePackages from nix.conf..

SCHEDULED: <2022-12-27 Tue>

  • State "DONE" from "NEXT" [2023-01-09 Mon 18:41]