{"id":32556655,"url":"https://github.com/szaffarano/nix-dotfiles","last_synced_at":"2026-04-12T13:54:52.569Z","repository":{"id":148604004,"uuid":"605036782","full_name":"szaffarano/nix-dotfiles","owner":"szaffarano","description":"Personal dotfiles implemented using nix, nix-darwin, home-manager and ansible","archived":false,"fork":false,"pushed_at":"2025-10-25T13:55:28.000Z","size":8318,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T15:22:56.506Z","etag":null,"topics":["ansible","darwin","dotfiles","linux","nix","nixos","sway"],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/szaffarano.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2023-02-22T10:02:58.000Z","updated_at":"2025-10-25T13:55:32.000Z","dependencies_parsed_at":"2023-05-20T16:45:50.750Z","dependency_job_id":"6415e4e0-1444-4e5e-839b-789f4fae657c","html_url":"https://github.com/szaffarano/nix-dotfiles","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/szaffarano/nix-dotfiles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaffarano%2Fnix-dotfiles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaffarano%2Fnix-dotfiles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaffarano%2Fnix-dotfiles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaffarano%2Fnix-dotfiles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/szaffarano","download_url":"https://codeload.github.com/szaffarano/nix-dotfiles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/szaffarano%2Fnix-dotfiles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281527380,"owners_count":26516845,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-28T02:00:06.022Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","darwin","dotfiles","linux","nix","nixos","sway"],"created_at":"2025-10-28T22:57:45.182Z","updated_at":"2026-04-12T13:54:52.562Z","avatar_url":"https://github.com/szaffarano.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NixOS Based dotfiles\n\n[![pre-commit](https://GitHub.com/szaffarano/nix-dotfiles/actions/workflows/pre-commit.yml/badge.svg)](https://github.com/szaffarano/nix-dotfiles/actions/workflows/pre-commit.yml)\n\n## Bootstrap\n\n### Preconditions\n\n1. Create an ssh keypair for the target machine\n\n   ```bash\n    # use a ramfs to not store the key in the disk\n    mkdir -p /tmp/pki/ram \u0026\u0026 sudo mount -t tmpfs -o size=10M tmpfs /tmp/pki/ram\n    mkdir -p /tmp/pki/ram/etc/ssh \u0026\u0026 cd /tmp/pki/ram/etc/ssh\n    ssh-keygen -t ed25519 -C \u003csome comment\u003e -f ssh_host_ed25519_key\n    ssh-keygen -t rsa -C \u003csome comment\u003e -f ssh_host_rsa_key\n   ```\n\n1. Generate an age recipient using the above public key (using the\n   [ssh-to-age](https://github.com/Mic92/ssh-to-age) tool)\n\n   ```bash\n    ssh-to-age  -i ssh_host_ed25519_key.pub -o ssh_host_ed25519_key.pub.age\n    ssh-to-age -private-key  -i ssh_host_ed25519_key -o ssh_host_ed25519_key.age\n   ```\n\n1. Update the [.sops.yaml](./.sops.yaml) configuration file adding the age\n   recipient.\n1. Generate secrets for this machine using both the root and your key\n   recipients. Example for the OS user:\n\n   ```bash\n        # copy the following command output\n        openssl passwd -6\n\n        # Add or edit the secrets.yaml file\n        sops system/\u003cmachine-name\u003e/secrets.yaml\n   ```\n\n### New machine configuration\n\n1. Based on an existent configuration, create a new one under the\n   [system](./system), e.g., `./system/\u003cmachine-name\u003e/default.nix`. Pay\n   attention to the [Disko](https://github.com/nix-community/disko) configuration\n   file to avoid any hard-to-recover mistakes.\n\n1. Same as above but with home-manager configurations, under [users](./users),\n   e.g., `./users/\u003cuser-name\u003e/\u003cmachine-name\u003e.nix`\n\n1. Boot the new machine using\n   [nixos-anywhere](https://github.com/nix-community/nixos-anywhere).\n   Eventually, you would need to install rsync, `nix-env -iA nixos.rsync` in the\n   target machine.\n\n1. Run nixos-anywhere in the host machine, including the SSH keys generated as\n   preconditions.\n\n   ```bash\n    tree /tmp/pki/ram\n    /tmp/pki/ram\n    └── etc\n        └── ssh\n            ├── ssh_host_ed25519_key\n            ├── ssh_host_ed25519_key.age.pub\n            └── ssh_host_ed25519_key.pub\n\n    # copy the pub keys as part of the new machine's configuration\n    cp /tmp/pki/ram/etc/ssh/*pub ./system/\u003cmachine-name\u003e\n\n    nix run github:nix-community/nixos-anywhere -- \\\n        --flake .#\u003cmachine-name\u003e \\\n        --extra-files /tmp/pki/ram root@\u003cnew-machine-ip\u003e\n   ```\n\n1. Once finished, login in to the new machine, clone the repo and run home-manager\n\n   ```bash\n    ssh \u003cuser-name\u003e@\u003cnew-machine-ip\u003e\n    git clone https://github.com/szaffarano/nix-dotfiles .dotfiles\n    cd .dotfiles\n    home-manager switch --flake .\n   ```\n\n### Raspberry Pi\n\n1. Build RPI image\n\n   ```bash\n    nix build '.#nixosConfigurations.\u003cname\u003e.config.system.build.sdImage'\n   ```\n\n1. Flash the image\n\n   ```bash\n    unzstd result/sd-image/nixos-sd-image-....img.zst -c \u003e nixos-sd-image.img\n    dd if=nixos-sd-image.img | pv | sudo dd of=/dev/mmcblk0 bs=64k\n   ```\n\n1. After booting, update the ssh keys\n\n   ```bash\n     # mount the NIXOS_SD partition\n     sudo cp /tmp/pki/ram/ssh/... /nixos/partition/etc/ssh/...\n   ```\n\n1. Remote deploy\n\n   ```bash\n    nixos-rebuild switch --flake .#\u003cname\u003e --target-host sebas@\u003cip\u003e  --use-remote-sudo\n   ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszaffarano%2Fnix-dotfiles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fszaffarano%2Fnix-dotfiles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fszaffarano%2Fnix-dotfiles/lists"}