{"id":17922282,"url":"https://github.com/amanjeev/somenix","last_synced_at":"2025-07-03T08:04:40.465Z","repository":{"id":58094702,"uuid":"219897215","full_name":"amanjeev/somenix","owner":"amanjeev","description":"AJ's NixOS config","archived":false,"fork":false,"pushed_at":"2024-01-23T17:26:12.000Z","size":441,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"primary","last_synced_at":"2024-01-23T18:47:49.991Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Nix","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amanjeev.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}},"created_at":"2019-11-06T02:42:58.000Z","updated_at":"2022-08-29T03:36:41.000Z","dependencies_parsed_at":"2023-02-16T22:01:47.006Z","dependency_job_id":"7d85b5a7-9222-474c-b839-775b6158ce5a","html_url":"https://github.com/amanjeev/somenix","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanjeev%2Fsomenix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanjeev%2Fsomenix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanjeev%2Fsomenix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amanjeev%2Fsomenix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amanjeev","download_url":"https://codeload.github.com/amanjeev/somenix/tar.gz/refs/heads/primary","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221932103,"owners_count":16903862,"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","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":[],"created_at":"2024-10-28T20:38:31.258Z","updated_at":"2024-10-28T20:38:31.978Z","avatar_url":"https://github.com/amanjeev.png","language":"Nix","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NixOS Configs using Flakes\n\n## How to change and install\n1. Clone this repo\n2. For a new machine\n    - add new platform in directory under `./platform/\u003cmachine\u003e`\n    - make appropriate changes from `configuration.nix` and `hadrware-configuration.nix`\n    - add the machine to `flake.nix`\n3. Run the `nixos-rebuild`: `sudo nixos-rebuild switch --install-bootloader --flake .#\u003cmachine\u003e`\n4. Move `./confs` files to their appropriate locations\n\n## Update (not upgrade)\n\n1. `cd ~/somenix`\n2. `sudo nix flake update`\n3. `sudo nixos-rebuild switch --flake .#machine-name`\n\n## List generations\n\n1. `cd ~/somenix`\n2. `sudo nix-env -p /nix/var/nix/profiles/system --list-generations`\n\n## Garbage collection\n\n1. `cd ~/somenix`\n2. `sudo nix-collect-garbage --delete-older-than 1d`\n3. `sudo nixos-rebuild switch --flake .#machine-name`\n\n## Add a new package\n\n1. Create a new file in [packages](./packages/) directory.\n2. Add various contents that your heart pleases. This is necessary because your heart will bleed debugging it.\n3. Pray.\n4. Add the call in [flake.nix](./flake.nix).\n## Debugging\n\n### Build locally while developing\n\n1. Use command `ix-build -E 'with import \u003cnixpkgs\u003e { }; callPackage ./packages/yourpackage.nix {}' --show-trace`\n2. Run `result/bin/yourpackage` if it builds fine\n\n### The SHA256 stuff\n\nYou may need various SHAs. You will need to try many many things. As an example, look at [nrfdfu.nix](./packages/nrfdfu.nix). It has two SHAs, one for `fetchFromGitHub` and other for `rustPlatform.buildRustPackage`.\n\n#### Pushing all 0s.\n\n```\n\u003e ERROR: cargoSha256 is out of date\n\u003e\n\u003e Cargo.lock is not the same in /build/nrfdfu-rs-v0.1.3-vendor.tar.gz\n\u003e\n\u003e To fix the issue:\n\u003e 1. Use \"0000000000000000000000000000000000000000000000000000\" as the cargoSha256 value\n\u003e 2. Build the derivation and wait for it to fail with a hash mismatch\n\u003e 3. Copy the 'got: sha256:' value back into the cargoSha256 field\n\u003e\n```\n\n#### Changing cargoHash to others\n\nLike using `carghoHash` to `cargoSha256` will give you better logs\n\n#### SHA from URL fetching \n\n```\nnix-prefetch-url --unpack --type sha256  https://github.com/user/mypackage/archive/vx.y.z.tar.gz\n```\n\n#### SRI format\n\nYou may need to convert the SHA256 into SRI format using this command\n\n```\nnix hash to-sri --type sha256  0784xz1svjfzsvcd0ghyrjqragvrasll674fn96hg660bv0df5gc\n```\n\n## Gratitude\n\n- [Spacekookie](https://twitter.com/spacekookie) for introducing me and giving me my first NixOS config to copy\n- [Ana, Hoverbear](https://twitter.com/a_hoverbear) for showing me the light of Nix Flakes and giving me the setup to copy\n- [Graham](https://twitter.com/grhmc/) on being in the NixOS community and constantly improving it\n- NixOS folks who constantly improve things\n- Friends of this land who help me out when I have questions","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famanjeev%2Fsomenix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famanjeev%2Fsomenix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famanjeev%2Fsomenix/lists"}