{"id":15171869,"url":"https://github.com/misuzu/nix-simple-deploy","last_synced_at":"2025-10-01T07:30:26.079Z","repository":{"id":57645193,"uuid":"233444400","full_name":"misuzu/nix-simple-deploy","owner":"misuzu","description":"Deploy software or an entire NixOS system configuration to another NixOS system.","archived":true,"fork":false,"pushed_at":"2021-08-09T17:50:34.000Z","size":38,"stargazers_count":56,"open_issues_count":0,"forks_count":6,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-01-17T18:11:11.902Z","etag":null,"topics":["command-line-tool","devops","nix","nixos","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/misuzu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-APACHE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-12T19:13:13.000Z","updated_at":"2024-08-17T20:40:22.000Z","dependencies_parsed_at":"2022-09-08T15:10:11.094Z","dependency_job_id":null,"html_url":"https://github.com/misuzu/nix-simple-deploy","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misuzu%2Fnix-simple-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misuzu%2Fnix-simple-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misuzu%2Fnix-simple-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/misuzu%2Fnix-simple-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/misuzu","download_url":"https://codeload.github.com/misuzu/nix-simple-deploy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234837154,"owners_count":18894548,"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":["command-line-tool","devops","nix","nixos","rust"],"created_at":"2024-09-27T09:20:58.173Z","updated_at":"2025-10-01T07:30:25.563Z","avatar_url":"https://github.com/misuzu.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"nix-simple-deploy\n=================\n![](https://github.com/misuzu/nix-simple-deploy/workflows/Continuous%20integration/badge.svg)\n\n## About\n\nDeploy a NixOS system configuration with `nix-simple-deploy system ...` to a remote\nmachine and switch the machine to that system configuration. You can also deploy\na nix store path with `nix-simple-deploy path ...` to a remote machine.\n\nThis is a Rust rewrite of unmaintained [nix-deploy](https://github.com/awakesecurity/nix-deploy).\n\n## Usage\n\nTo get started generate signing key first:\n```bash\n$ nix-store --generate-binary-cache-key cache.example.com-1 signing-key.sec signing-key.pub\n```\n\nThen add contents of ```signing-key.pub``` to remote's ```configuration.nix``` and run ```nixos-rebuild switch```:\n```nix\n{\n  nix.binaryCachePublicKeys = [ \"cache.example.com-1:\u003cSTRING FROM signing-key.pub\u003e\" ];\n}\n```\n\nNow you are ready to deploy stuff!\n\nTo simply copy some store path use `nix-simple-deploy path`:\n```bash\n$ nix-simple-deploy path \\\n  --use-remote-sudo \\\n  --use-substitutes \\\n  --signing-key signing-key.sec \\\n  --target-host user@remote-server \\\n  $(type -p firefox)\n```\n\nTo deploy whole system use `nix-simple-deploy system`:\n```bash\n# copy hardware configuration from remote host to hardware-configuration.nix\n$ ssh user@remote-server nixos-generate-config --show-hardware-config \u003e ./hardware-configuration.nix\n# build system from configuration.nix\n$ nix-build '\u003cnixpkgs/nixos\u003e' -Q -A system -I nixos-config=./configuration.nix\n# deploy system to remote host\n$ nix-simple-deploy system \\\n  --use-remote-sudo \\\n  --use-substitutes \\\n  --signing-key signing-key.sec \\\n  --target-host user@remote-server \\\n  $(readlink -f ./result) \\\n  switch\n```\n\n## Install\n\nJust add it to `environment.systemPackages` (nixpkgs-unstable):\n```nix\n{\n  environment.systemPackages = [\n    pkgs.nix-simple-deploy\n  ];\n}\n```\n\nTo run ```nix-simple-deploy``` from git tree run:\n```bash\n$ nix-shell -p cargo -p nix-serve\n$ cargo run -- --help\n```\n\nYou can also build `nix-simple-deploy` directly from provided `default.nix` expression from this repo. Just setup `rev` value and appropriate `sha256`:\n\n```nix\n{\n  nix-simple-deploy = pkgs.callPackage (pkgs.fetchFromGitHub {\n    rev = \"...\";\n    owner = \"misuzu\";\n    repo = \"nix-simple-deploy\";\n    sha256 = \"...\";\n  }) {};\n}\n```\nThen you can add it to your `shell.nix` `buildInputs` or system wide into `environment.systemPackages`:\n\n```nix\n{\n  environment.systemPackages = [\n    nix-simple-deploy\n  ];\n}\n```\n\n## Help output\n\n```bash\n$ nix-simple-deploy --help\nDeploy software or an entire NixOS system configuration to another NixOS system\n\nUSAGE:\n    nix-simple-deploy \u003cSUBCOMMAND\u003e\n\nFLAGS:\n    -h, --help       Prints help information\n    -V, --version    Prints version information\n\nSUBCOMMANDS:\n    help      Prints this message or the help of the given subcommand(s)\n    path      Deploy a path to the NixOS target host\n    system    Deploy a system to the NixOS target host\n```\n\n```bash\n$ nix-simple-deploy path --help\nDeploy a path to the NixOS target host\n\nUSAGE:\n    nix-simple-deploy path [FLAGS] [OPTIONS] \u003cPATH\u003e --target-host \u003cUSER@HOST\u003e\n\nFLAGS:\n    -h, --help               Prints help information\n        --use-remote-sudo    When set, nix-simple-deploy prefixes remote commands that run on the --target-host systems\n                             with sudo. Setting this option allows deploying using remote non-root user\n    -s, --use-substitutes    Attempt to download missing paths on the target machine using Nix’s substitute mechanism.\n                             Any paths that cannot be substituted on the target are still copied normally from the\n                             source\n\nOPTIONS:\n        --extra-ssh-options \u003cssh-options\u003e        Extra options for ssh binary\n    -n, --nix-serve-port \u003cport\u003e\n            Port used for nix-serve, use this option if you have other services that use port 9999 on local or remote\n            machine [default: 9999]\n    -p, --profile-path \u003c/path/to/nix/profile\u003e    Profile path\n    -k, --signing-key \u003c/path/to/signing-key\u003e     File containing the secret signing key\n        --store \u003c/mnt\u003e                           Use different nix store root\n    -t, --target-host \u003cUSER@HOST\u003e                Specifies the NixOS target host\n\nARGS:\n    \u003cPATH\u003e    Nix store path\n```\n\n```bash\n$ nix-simple-deploy system --help\nDeploy a system to the NixOS target host\n\nUSAGE:\n    nix-simple-deploy system [FLAGS] [OPTIONS] \u003cPATH\u003e \u003cACTION\u003e --target-host \u003cUSER@HOST\u003e\n\nFLAGS:\n    -h, --help               Prints help information\n        --use-remote-sudo    When set, nix-simple-deploy prefixes remote commands that run on the --target-host systems\n                             with sudo. Setting this option allows deploying using remote non-root user\n    -s, --use-substitutes    Attempt to download missing paths on the target machine using Nix’s substitute mechanism.\n                             Any paths that cannot be substituted on the target are still copied normally from the\n                             source\n\nOPTIONS:\n        --extra-ssh-options \u003cssh-options\u003e        Extra options for ssh binary\n    -n, --nix-serve-port \u003cport\u003e\n            Port used for nix-serve, use this option if you have other services that use port 9999 on local or remote\n            machine [default: 9999]\n    -p, --profile-path \u003c/path/to/nix/profile\u003e    Profile path [default: /nix/var/nix/profiles/system]\n    -k, --signing-key \u003c/path/to/signing-key\u003e     File containing the secret signing key\n    -t, --target-host \u003cUSER@HOST\u003e                Specifies the NixOS target host\n\nARGS:\n    \u003cPATH\u003e      Nix store path\n    \u003cACTION\u003e    Desired operation [possible values: switch, boot, test, dry-activate, reboot]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisuzu%2Fnix-simple-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmisuzu%2Fnix-simple-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmisuzu%2Fnix-simple-deploy/lists"}